var yy = {}; yy.init = function(){ yy.events(); //事件总体控制 } //事件总体控制 yy.events = function(){ yy.nav(); yy.scroll(); yy.wow(); } //导航 yy.nav = function(){ $(".nav li").hover(function(){ if($(window).width() > 997){ $(this).find(".nav_er").stop().slidedown(); } },function(){ if($(window).width() > 997){ $(this).find(".nav_er").stop().slideup(); } }); $(".nav_btn").click(function(){ $(this).toggleclass("opennav"); $(".head .nav").slidetoggle(); $("body").toggleclass("ofhidden"); }); $(".nav li>a").click(function(e){ if($(window).width() <= 997){ if($(this).siblings(".nav_er").find("a").length > 0){ e.preventdefault(); $(this).siblings(".nav_er").slidetoggle(); $(this).parents().siblings().find(".nav_er").slideup(); } } }); //内页 $(".in_top .innav_t").click(function(){ $(".in_top .in_nav").slidetoggle(); }); } //滚动事件 yy.scroll = function(){ } yy.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(){ yy.init(); });