$(function(){ $.fn.extend({ //顶部浮动 topNavPosition : function(){ var _this = this; var _father = _this.parent(); var _last = _this.find(".header-last-box"); var _animate = true; $(window).scroll( function(){ if($(window).scrollTop()>35 && _animate == true){ _father.animate({ height:"60px" }); _this.css({ "box-shadow":"1px 1px 30px #999" }) _this.animate({ top:"-35px" }); _last.animate({ height:"60px" }); _animate = false; } if($(window).scrollTop() == 0){ _father.animate({ height:"115px" }); _this.css({ "box-shadow":"0px 0px 0px #999" }) _this.animate({ top:"0" },300); _last.animate({ height:"80px" }); _animate = true; } } ) }, //顶部下拉菜单 topDropDownMwnu:function(){ $(this).hover(function(){ var _thisID = $(this).attr('id'); $('.drop-down-menu').css({ display:'block' }); $('.'+_thisID).css({ display:'block' }).siblings().css({ display:'none' }) },function(){ $('.drop-down-menu').css({ display:'none' }); }); $('.drop-down-menu').hover(function(){ $('.drop-down-menu').css({ display:'block' }) },function(){ $('.drop-down-menu').css({ display:'none' }) }); } }); function pageFun(){ $('.header-nav-content-box').topNavPosition(); $('.drop-down-but').topDropDownMwnu(); } pageFun(); })