// function AddFavorite(sURL, sTitle){ try{window.external.addFavorite(sURL, sTitle);} catch (e){ try{window.sidebar.addPanel(sTitle, sURL, "");} catch (e){alert("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔鑷姩娣诲姞鍔熻兘锛岃浣跨敤Ctrl+D杩涜娣诲姞");} } } $.extend({ 'topTo':function(to, time){ var time = time || 500, $obj = (window.opera)?(document.compatMode=="CSS1Compat"?$('html'):$('body')):$('html,body'); if($(document).scrollTop()!=to) $($obj).stop().animate({scrollTop:to}, time); } }); (function($){ $.fn.hoverDelay = function(options){ var defaults = { hoverDuring: 100, outDuring: 100, hoverEvent: function(){ $.noop(); }, outEvent: function(){ $.noop(); } }; var sets = $.extend(defaults,options || {}); var hoverTimer, outTimer; return $(this).each(function(){ $(this).hover(function(){ clearTimeout(outTimer); hoverTimer = setTimeout(sets.hoverEvent, sets.hoverDuring); },function(){ clearTimeout(hoverTimer); outTimer = setTimeout(sets.outEvent, sets.outDuring); }); }); } })(jQuery); /* $('.nav>li').each(function(index, element) { var that = $(this); that.hoverDelay({ hoverEvent: function(){ $('ul',that).slideDown(200); }, outEvent: function(){ $('ul',that).slideUp(200); } }); }); */ $(document).ready(function(){ $(window).resize(function() { if( typeof page_resize === 'function' ) page_resize(); }); base(); }); function base(){ // 绉诲姩鑿滃崟涓嬫媺 $('.wap-menu').on('click', function(){ if( $(this).data('open')=='y' ){ $('.menu>li').stop().slideUp(200); $('span', this).removeClass('icon-x1').addClass('icon-menu1'); $(this).data('open', 'n'); }else{ $('.menu>li').stop().slideDown(200); $('span', this).removeClass('icon-menu1').addClass('icon-x1'); $(this).data('open', 'y'); } }); // Banner $loop = $('.swiper-banner .swiper-slide').length>2 ? true : false; var swiper_banner = new Swiper('.swiper-banner', { parallax: true,speed:800,effect:"fade",/*grabCursor:true,*/loop:$loop, autoplay: { delay: 3500, disableOnInteraction: false}, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }); $('.swiper-banner').hover(function(){ swiper_banner.autoplay.stop(); },function(){ swiper_banner.autoplay.start(); }); setTimeout(function(){ swiper_banner.slideToLoop(1); swiper_banner.removeSlide(0); swiper_banner.autoplay.stop(); swiper_banner.autoplay.start(); }, 100); // 棣栭〉鍥剧墖鏂伴椈杞挱 var swiper_news = new Swiper('.swiper-news', { grabCursor:true,loop:true, autoplay: { delay: 3500, disableOnInteraction: false, }, pagination: { el: '.swiper-pagination', clickable: true, renderBullet: function (index, className) { return '' + (index + 1) + ''; }, }, }); $('.swiper-news').hover(function(){ swiper_news.autoplay.stop(); },function(){ swiper_news.autoplay.start(); }); // 棣栭〉涓撻杞挱 var swiper_zti = new Swiper('.swiper-zti', { grabCursor:true,loop:true, autoplay: { delay: 3000, disableOnInteraction: false, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }); $('.swiper-zti').hover(function(){ swiper_zti.autoplay.stop(); },function(){ swiper_zti.autoplay.start(); }); // 鍏ㄥ眬鍔ㄧ敾 var $obj_delay = ''; $('.box' + $obj_delay).addClass('wow fadeInUp'); var $objs_delay = $obj_delay.split(', '); $.each($objs_delay,function(index,value){ var $delay_i = 0; $(value).each(function(index,value){ $delay_i = index*.1; $(value).attr('data-wow-delay', $delay_i+'s'); }); }); new WOW().init(); // totop鎸夐挳 $(window).scroll(function(e) { if($(window).scrollTop()>300 && $(window).width()>980){ $('.totop').fadeIn(); }else{ $('.totop').fadeOut(); } }); $('.totop').on('click', function(event) { event.preventDefault(); $.topTo(0); }); if( typeof page_ini === 'function' ) page_ini(); }