(function($,plugin){var data={},id=1,etid=plugin+'etid';$.fn[plugin]=function(speed,group){id++;group=group||this.data(etid)||id;speed=speed||200;if(group===id)this.data(etid,group);this._hover=this.hover;this.hover=function(over,out){over=over||$.noop;out=out||$.noop;this._hover(function(event){var elem=this;cleartimeout(data[group]);data[group]=settimeout(function(){over.call(elem,event)},speed)},function(event){var elem=this;cleartimeout(data[group]);data[group]=settimeout(function(){out.call(elem,event)},speed)});return this};return this};$.fn[plugin+'pause']=function(){cleartimeout(this.data(etid));return this};$[plugin]={get:function(){return id++},pause:function(group){cleartimeout(data[group])}}})(jquery,'mousedelay'); //star var header={ main:function(){ //打开搜索 var btnopen_s=$(".open-search"), open_s_box=$(".top-search"); btnopen_s.click(function(e) { $(this).toggleclass("on"); open_s_box.stop(true, true).fadetoggle(); $(document).on("click", function() { open_s_box.stop(true, true).fadeout(); btnopen_s.removeclass("on"); }); e.stoppropagation(); }); open_s_box.on("click", function(e) { e.stoppropagation(); }); //导航菜单 $(function ($) { $(window).on("resize", function (e) { if($(window).width()>1025){ $(".top-menu li .sub").removeattr("style"); header.pcmenu(); } else{ header.wapmenu(); } }).trigger("resize"); }); }, pcmenu:function(){ $(".nav li").each(function(){ var e=$(this).find(".sub").find("span").length var _this=$(this).find(".sub").find("dl") if(e>=1){ // var ss=_this.find("em").length // if(ss>=1){ // _this.addclass("two"); // } // if(ss<=0){ // _this.find("dd").remove(); // } $(this).addclass("has-sub"); $(this).mousedelay(false).hover(function(){ $(this).find(".sub").slidedown(); },function(){ $(this).find(".sub").slideup(); }); } }); }, wapmenu:function(){ $(".nav li").unbind(); $("i.op").remove(); $(".nav li").each(function(){ var e=$(this).find(".sub").find("span").length if(e>=1){ $(this).find("b").append(""); var op=$(this).find("b").find(".op") op.click(function(){ $(this).toggleclass("click"); $(this).parent().next(".sub").slidetoggle(); $(this).parents("li").siblings().find(".op").removeclass("click"); $(this).parents("li").siblings().find(".sub").slideup(); }); } }); //打开移动端导航 $(".open-menu").unbind(); $(".open-menu").click(function(e) { $(this).toggleclass("on"); $("body").toggleclass("menu-show"); $(document).on("click", function() { $("body").removeclass("menu-show"); $(".open-menu").removeclass("on"); }); e.stoppropagation(); }); $(".nav").on("click", function(e) { e.stoppropagation(); }); }, topselect: function (navid) { $("#nav" + navid).addclass("aon"); $(".nav li").hover(function(){ $(this).addclass("aon").siblings().removeclass("aon"); $(this).addclass("ahover").siblings().removeclass("ahover"); },function(){ $(this).removeclass("aon ahover"); $("#nav" + navid).addclass("aon"); $("#nav" + navid).addclass("ahover"); }); }, search: function (a, b, c, d) { $(a).jqsearch({ txtval: b, keytxt1: "输入关键词搜索!", keytxt2: "输入的关键词字数不要过多!", keytxt3: "您输入的内容存在特殊字符!", keyid: c, //输入框id keyurl: d, //跳转链接 keyhref: "key", //链接传值 static: false //是否静态站 }); } }