var jj = {}; jj.init = function(){ jj.events(); //事件总体控制 } //事件总体控制 jj.events = function(){ jj.nav(); jj.search(); jj.tab(); jj.wow(); } //导航 jj.nav = function(){ $(".btn-nav").click(function(){ $(".header-nav").stop().slidetoggle(); }); } //搜索框长度 jj.search = function(){ if($(window).width()<=668){ $(".subbox").width($(window).width()-30); } } //内页面的小导航 jj.tab=function(){ $(".zxcy_nav").on("click","li",function(){ $(this).addclass("active").siblings().removeclass("active"); }); $(".header-nav li").hover(function(){ $(this).find(".subnav").stop().slidedown(); },function(){ $(this).find(".subnav").stop().slideup(); }); } jj.wow=function(){ if (!(/msie [6|7|8|9]/i.test(navigator.useragent))){ var wow = new wow({ boxclass: 'wow', // animated element css class (default is wow) animateclass: 'animated', // animation css class (default is animated) offset: 50, // distance to the element when triggering the animation (default is 0) mobile: true, // trigger animations on mobile devices (default is true) live: true, // act on asynchronously loaded content (default is true) callback: function(box) { // the callback is fired every time an animation is started // the argument that is passed in is the dom node being animated } }); wow.init(); }; } //dom加载完毕执行 $(function(){ jj.init(); });