$(function () { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, live: true }); if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { wow.init(); }; var width=$(window).width(); $('.header .search').click(function () { $('.header .search-list').fadeIn(); }); $(document).mouseup(function (e) { var con = $('.header .search-box'); // 设置目标区域 if (!con.is(e.target) && con.has(e.target).length === 0 ) { $('.header .search-list').fadeOut(); } }); $('.search-btns').click(function(){ var str = $('.search-center input').val(); if(str){ window.open('/search.html?keywords=' + str+'&appIds=all', '_self'); } }); $(document).on('keydown', function(ev) { if (ev.keyCode == 13) { var str = $('.search-center input').val(); if (str) { window.open('/search.html?keywords=' + str + '&appIds=all', '_self'); } } }); if(width>1024){ window.addEvent('scroll', function () { if (window.scrollY <= 10) { $('.header').removeClass('active'); } else { $('.header').addClass('active'); } }); $('.header .con .nav .nav-right> ul > li').each(function(index){ $(this).hoverDelay({ hoverDuring: 300, outDuring: 100, hoverEvent:function(){ $(this).addClass('active').siblings().removeClass('active'); if($(this).find('.nav-list').length>0){ $(this).find('.nav-list').slideDown(); $(this).find('h2').addClass('active'); } }, outEvent:function () { $(this).removeClass('active'); $(this).find('.nav-list').slideUp(); $(this).find('h2').removeClass('active'); } }); }); }else{ $('.header').addClass('active'); $('.nav-button').click(function () { $('.header .nav').addClass('active'); }); $('.header .nav .closes').click(function () { $('.header .nav').removeClass('active'); }); // $('.header .con .nav .nav-right> ul > li').click(function () { // $(this).find('.nav-list').slideToggle(); // $(this).siblings().find('.nav-list').slideUp(); // $(this).toggleClass('active'); // $(this).siblings().removeClass('active'); // }); } });