$(function () { var $navTop = $('#topNav'), $navMain = $navTop.find('#navMain'), $navSub = $navMain.find('#navSub'), $navIndex = $navMain.find('#navIndex'), $navClose = $navMain.find('.close_bt'), de = 200; $navIndex.mouseenter(function () { $navSub.show().stop().animate({ 'height': '215px' }, de); $navTop.stop().animate({ 'height': '285px' }, de); }); $navMain.mouseleave(function () { $navSub.stop().animate({ 'height': '3px' }, de, function () { $navSub.hide(); }); $navTop.stop().animate({ 'height': '70px' }, de); }); });