// JavaScript Document $(document).ready(function() { //婊氬姩瑙﹀彂鍔ㄧ敾 new WOW().init(); //鍘婚櫎TABLE P鏍囩 /*$('.cont-box table p').each(function(){ $(this).parent().attr('style',$(this).attr('style')); var pHtml = $(this).html(); $(this).parent().html(pHtml); console.log(pHtml); })*/ //鑷姩楂樺害鐨勫厓绱狅紝鍑忓幓楂樺害鐨勫厓绱 //autoHeight('.cont-bd',['.nav-box','.swiper-banner','.banner-bg-min','.banner-bg-min-02','.menu-bg','.footer-bg']); //浜屽€嶅浘閫傞厤 image2x('.image-2x'); //PC瀵艰埅 $('.nav-list li').mouseover(function(e){ $(this).find('.nav-list-box-sec').slideDown(150); $(this).siblings().find('.nav-list-box-sec').slideUp(150); }) $('.nav-list li').mouseleave(function(e){ $(this).find('.nav-list-box-sec').slideUp(150); }) /* $('.nav-list li>a').click(function(e){ stopDefault(e); })*/ //鎵嬫満鎼滅储 $('.m-search-btn').click(function(){ $('.m-search-btn').addClass('m-hide'); $('.m-nav-btn').addClass('m-hide'); $('.swiper-ind').addClass('m-hide'); $('.m-nav-close').addClass('m-show'); $('.m-search').addClass('m-show'); $('.banner-min').addClass('m-hide'); $('.cont-box').addClass('m-hide'); $('.m-footer').removeClass('m-show').addClass('m-hide'); }) //鎵嬫満瀵艰埅 $('.m-nav-btn').click(function(){ $('.m-search-btn').addClass('m-hide'); $('.m-nav-btn').addClass('m-hide'); $('.swiper-ind').addClass('m-hide'); $('.m-nav-close').addClass('m-show'); $('.m-nav').addClass('m-show'); $('.banner-min').addClass('m-hide'); $('.cont-box').addClass('m-hide'); $('.m-footer').removeClass('m-show').addClass('m-hide'); }) //鎵嬫満浜岀骇瀵艰埅 $('.m-nav dt a').click(function(e){ //鏀惰捣鎵€浠ヤ笁绾у鑸 $('.m-thr-on').removeClass('m-thr-on'); $('.m-thr-nav').slideUp(); if($(this).parent().next('dd').find('div').length>0){ stopDefault(e); if($(this).parent().hasClass('m-sec-on')){ $('.m-sec-on').removeClass('m-sec-on'); }else{ $('.m-sec-on').removeClass('m-sec-on'); $(this).parent().addClass('m-sec-on'); } $(this).parent().next('dd').slideToggle(); $(this).parents('li').siblings().find('dd').slideUp(); }else{ $(this).parents('li').siblings().find('dd').slideUp(); } }) //鎵嬫満涓夌骇瀵艰埅 $('.m-sec-nav span a').click(function(e){ if($(this).parent().next('.m-thr-nav').find('span').length>0){ stopDefault(e); if($(this).parent().hasClass('m-thr-on')){ $('.m-thr-on').removeClass('m-thr-on'); }else{ $('.m-thr-on').removeClass('m-thr-on'); $(this).parent().addClass('m-thr-on'); } $(this).parent().next('.m-thr-nav').slideToggle(); $(this).parents('.m-sec-nav').siblings().find('.m-thr-nav').slideUp(); }else{ $(this).parents('.m-sec-nav').siblings().find('.m-thr-nav').slideUp(); } }) //鍏抽棴鎸夐挳 $('.m-nav-close').click(function(){ $('.m-search-btn').removeClass('m-hide'); $('.m-nav-btn').removeClass('m-hide'); $('.swiper-ind').removeClass('m-hide'); $('.m-nav-close').removeClass('m-show'); $('.m-search').removeClass('m-show'); $('.m-nav').removeClass('m-show'); $('.m-nav dd').slideUp(); $('.m-thr-nav').slideUp(); $('.m-sec-on').removeClass('m-sec-on'); $('.m-thr-on').removeClass('m-thr-on'); $('.banner-min').removeClass('m-hide'); $('.cont-box').removeClass('m-hide'); $('.m-footer').removeClass('m-hide'); //txtRandom('.banner-shade'); }) layui.use('layer', function(){ var layer = layui.layer; //鐩稿唽寮瑰眰 layer.photos({ photos: '#layer-photos' ,anim: 5 //0-6鐨勯€夋嫨锛屾寚瀹氬脊鍑哄浘鐗囧姩鐢荤被鍨嬶紝榛樿闅忔満锛堣娉ㄦ剰锛?.0涔嬪墠鐨勭増鏈敤shift鍙傛暟锛 ,shade: .85 }); var vid = 0; $('.video-btn').each(function(index,el){ $(this).attr('data-num',index); }) $('.video-btn').click(function(e){ vid = $(this).attr('data-num'); var flag = false; var type = ["mp4"]; var tit = $(this).attr('data-title')?$(this).attr('data-title'):''; var index = $(this).attr('data-video').lastIndexOf("."); var ext = $(this).attr('data-video').substr(index+1); //寰幆姣旇緝 for(var i=0;i褰撳墠娴忚鍣ㄤ笉鏀寔 video鐩存帴鎾斁', }); var video = document.getElementById("video"); video.play(); }else{ layer.open({ type: 2, title: false, shade: 0.7, anim: 5, isOutAnim:false, skin:'video-show', content: $(this).attr('data-video'), }); } //鍒涘缓鎸夐挳鍚嶇О $('.video-show .layui-layer-content').append('
'+tit+'
'); vidBtn('.video-prev','.video-next',vid,0,$('.video-btn').length); }); //瑙嗛鍒囨崲 $('body').on('click','.video-switch-btn',function(){ if($(this).hasClass('video-prev')){ vid--; }else if($(this).hasClass('video-next')){ vid++; } $(this).parent().find('video').attr('src',$("[data-num='"+vid+"']").attr('data-video')); $(this).parent().find('.video-tit span').html($("[data-num='"+vid+"']").attr('data-title')?$("[data-num='"+vid+"']").attr('data-title'):''); var video = document.getElementById("video"); video.play(); vidBtn('.video-prev','.video-next',vid,0,$('.video-btn').length); }) //榧犳爣缁忚繃鍔ㄧ敾 $('.e-anim').hover(function(){ $(this).addClass('anim-on').removeClass('anim-off'); },function(){ $(this).addClass('anim-off').removeClass('anim-on'); }); //榧犳爣缁忚繃棣栭〉鍒囨崲鏄剧ず闅愯棌鍔ㄧ敾 $('.top-share-btn dl').hover(function(){ if(!phoneIs() && $(this).find('.e-anim-hide').length){ animOn(this); } },function(){ if(!phoneIs() && $(this).find('.e-anim-hide').length){ animOff(this); } }); // pc棣栭〉瀵艰埅 $('.nav-btn').click(function(){ $(this).toggleClass('nav-btn-on'); if($(this).hasClass('nav-btn-on')){ $('.swiper-ind .swiper-slide').append('
'); animOn('.nav-list-box'); }else{ $('.swiper-hide').remove(); animOff('.nav-list-box'); } }) $('.nav-list-box').mouseover(function(e){ propagation(e); }) // 绂诲紑PC瀵艰埅 $('.swiper-ind').on('mouseover','.swiper-hide',function(e){ $('.swiper-hide').remove(); if($('.nav-btn').hasClass('nav-btn-on')){ $('.nav-btn').removeClass('nav-btn-on'); animOff('.nav-list-box'); } }) // pc鏂伴椈璧勮 $('.xwzx-box li').mouseenter(function(){ $(this).addClass('on').siblings().removeClass('on'); }) // 鎼滅储 $('.search').mouseenter(function(){ $(this).addClass('search-show'); }) $('.header-02').mouseleave(function(){ $('.search').removeClass('search-show'); }) $('.search input').focus(function(){ $('.search').addClass('search-show-02'); }) $('.search input').blur(function(){ $('.search').removeClass('search-show-02'); }) // 灞曞紑鍏抽棴浜岀骇 $('.nav-02 li').mouseenter(function(){ $(this).addClass('on'); if($(this).find('.nav-box-sec').length>0){ animOn($(this).find('.nav-box-sec')); } }) $('.nav-02 li').mouseleave(function(){ $(this).removeClass('on'); if($(this).find('.nav-box-sec').length>0){ animOff($(this).find('.nav-box-sec')); } }) // 灞曞紑鍏抽棴涓夌骇 $('.nav-btn-sec').mouseenter(function(){ $(this).addClass('on'); if($(this).find('.nav-box-thr').length>0){ animOn($(this).find('.nav-box-thr')); } }) $('.nav-btn-sec').mouseleave(function(){ $(this).removeClass('on'); if($(this).find('.nav-box-thr').length>0){ animOff($(this).find('.nav-box-thr')); } }) //瀹炵敤绠€鏄撳垏鎹㈡櫘閫 $('.tabs-box-ord').each(function(){ $(this).find('.hd-ord>*').eq(0).addClass('on'); $(this).find('.bd-ord>*').eq(0).show().siblings().hide(); $(this).find('.bdl-ord>*').eq(0).show().siblings().hide(); }) $('.tabs-box-ord .hd-ord>*').on('click',function(e){ $(this).addClass('on').siblings().removeClass('on'); $(this).parents('.tabs-box-ord').find('.bd-ord>*').eq($(this).index()).show().siblings().hide(); $(this).parents('.tabs-box-ord').find('.bdl-ord>*').eq($(this).index()).show().siblings().hide(); }) //杩斿洖椤堕儴 $('.totop').click(function(){ $('html,body').animate({scrollTop:0}, document.body.scrollHeight/10); }) //menu $('.menu-line').each(function(){ var nemul = 0; $('.menu-l .on').length>0?nemul = $('.menu-l .on').position().left:nemul; var nemuw = 0; $('.menu-l .on').length>0?nemuw = $('.menu-l .on').outerWidth():nemuw; $('.menu-line').css({'width':nemuw,'left':nemul}); }) $('.menu-l a').mouseenter(function(){ $('.menu-line').css({'width':$(this).outerWidth(),'left':$(this).position().left}); }) $('.menu-l ul').mouseleave(function(){ var nemuw = 0; $('.menu-l .on').width()?nemuw = $('.menu-l .on').width():nemuw; if($('.menu-l .on').length>0){ $('.menu-line').css({'width':nemuw,'left':$('.menu-l .on').position().left}); }else{ $('.menu-line').css({'width':nemuw}); } }); }); //娴忚鍣ㄧ増鏈彁绀 myBrowser(); var tips ="
鎮ㄥ綋鍓嶇殑娴忚鍣ㄧ増鏈繃浣庯紝缃戠珯閮ㄥ垎鍔熻兘灏嗘棤娉曟甯告樉绀猴紝璇锋洿鏂版偍鐨勬祻瑙堝櫒銆侟/div>"; if (myBrowser() == "FF") { } if (myBrowser() == "Opera") { } if (myBrowser() == "Safari") { } if (myBrowser() == "IE55") { $("body").prepend(tips); } if (myBrowser() == "IE6") { $("body").prepend(tips); } if (myBrowser() == "IE7") { $("body").prepend(tips); } if (myBrowser() == "IE8") { $("body").prepend(tips); } }); $(window).scroll(function() { }); var sizeTimer = null; $(window).resize(function() { clearTimeout(sizeTimer); sizeTimer = setTimeout(function(){ },400); }); $(window).load(function() { }); //缃戠珯绫诲瀷 function phoneIs() { if($('.nav-box .container').outerWidth()<960){ return true }else{ return false; } } //娴忚鍣ㄧ増鏈垽鏂 function myBrowser(){ var userAgent = navigator.userAgent; //鍙栧緱娴忚鍣ㄧ殑userAgent瀛楃涓 var isOpera = userAgent.indexOf("Opera") > -1; //鍒ゆ柇鏄惁Opera娴忚鍣 var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //鍒ゆ柇鏄惁IE娴忚鍣 var isFF = userAgent.indexOf("Firefox") > -1; //鍒ゆ柇鏄惁Firefox娴忚鍣 var isSafari = userAgent.indexOf("Safari") > -1; //鍒ゆ柇鏄惁Safari娴忚鍣 if (isIE) { var IE5 = IE55 = IE6 = IE7 = IE8 = false; var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); reIE.test(userAgent); var fIEVersion = parseFloat(RegExp["$1"]); IE55 = fIEVersion == 5.5; IE6 = fIEVersion == 6.0; IE7 = fIEVersion == 7.0; IE8 = fIEVersion == 8.0; if (IE55) { return "IE55"; } if (IE6) { return "IE6"; } if (IE7) { return "IE7"; } if (IE8) { return "IE8"; } }//isIE end if (isFF) { return "FF"; } if (isOpera) { return "Opera"; } } //鑾峰彇宸﹀亸绉诲€ function navl(obj){ if(!phoneIs()){ $(obj).find('.nav-list-sub').removeAttr('style'); var pl = 0; parentLeft(obj); var lmax = pl + $(obj).find('.nav-list-height').outerWidth()-$('.container-header').position().left; //鍒ゆ柇宸﹀亸绉诲姞瀹藉害鏄惁瓒呭嚭 if(lmax > $('.nav-box .container').width()){ var l = $('.nav-box .container').width() - lmax; $(obj).find('.nav-list-sub').css('width',$(obj).find('.nav-list-height').outerWidth()+1); $(obj).find('.nav-list-sub').css('left',l); }else{ $(obj).find('.nav-list-sub').css('width',$(obj).find('.nav-list-height').outerWidth()+1); } }else{ $('.nav-list-sub').css('width',''); } //閫掑綊鍒癰ody function parentLeft(obj){ if(!$(obj).is('body')){ parentLeft($(obj).parent()) } pl += $(obj).position().left; } } //swiper2.x,auto鏄剧ず鏁伴噺 function swiperSL(cla,obj,ss,mm,ll){ swiperDX(cla,obj,ss,mm,ll); $(window).resize(function() { swiperDX(cla,obj,ss,mm,ll); }); } function swiperDX(c,o,s,m,l){ var w = $('.container').outerWidth(); var x = $(c).outerWidth(); if(w>=960){ $(c).find('.swiper-slide').css('width',x/l); }else if(w>=720){ $(c).find('.swiper-slide').css('width',x/m); }else{ $(c).find('.swiper-slide').css('width',x/s); } o.resizeFix(); } //璁惧妯珫灞忓垽鏂 /*window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() { //绔栧睆 if (window.orientation === 180 || window.orientation === 0) { $('html').removeClass('landscape'); } //妯睆鏃舵彁绀 if (window.orientation === 90 || window.orientation === -90 ){ $('html').addClass('landscape'); } }, false);*/ //杩涘叆鍏ㄥ睆 function enterFullScreen() { var de = document.documentElement; if (de.requestFullscreen) { de.requestFullscreen(); } else if (de.mozRequestFullScreen) { de.mozRequestFullScreen(); } else if (de.webkitRequestFullScreen) { de.webkitRequestFullScreen(); } } //閫€鍑哄叏灞 function exitFullScreen() { var de = document; if (de.exitFullscreen) { de.exitFullscreen(); } else if (de.mozCancelFullScreen) { de.mozCancelFullScreen(); } else if (de.webkitCancelFullScreen) { de.webkitCancelFullScreen(); } } //鍒ゆ柇鏄惁鍏ㄥ睆 $(window).resize(function() { var fullscreenElement = document.fullscreenEnabled || document.mozFullscreenElement || document.webkitFullscreenElement; var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled; if (fullscreenElement == null) { //闈炲叏灞 $('.icon-fullscreen').show(); $('.icon-fullexit').hide(); } else { //鍏ㄥ睆 $('.icon-fullscreen').hide(); $('.icon-fullexit').show(); } }); //瑙嗛鑳屾櫙灞呬腑 function bgVideo(id,opt){ var bgVideo = document.getElementById(id); var vidH = opt.height?opt.height:document.body.offsetWidth; var videoWH,videoVW,videoVH,videoTime; //瑙嗛鍒濆鍖 bgVideo.onresize = function(){ videoSize(); } document.read = function(){ clearTimeout(videoTime) videoTime = setTimeout(function(){videoSize()},50); } addEventOnLoad(function(){ clearTimeout(videoTime) videoTime = setTimeout(function(){videoSize()},50); }) addEventOnResize(function(){ clearTimeout(videoTime) videoTime = setTimeout(function(){videoSize()},50); }) //瑙嗛鑳屾櫙缂╂斁璁$畻 function videoSize(){ videoVW = bgVideo.videoWidth; videoVH = bgVideo.videoHeight; videoWH =videoVW/videoVH; var windowW = document.documentElement.clientWidth; var windowH = vidH; //瀹介珮姣斾緥姣旇緝 if( windowW / windowH > videoWH ){ // bgVideo.classList.add('video-bg-w'); // bgVideo.classList.remove('video-bg-h'); bgVideo.style.width = windowW+'px'; bgVideo.style.height = windowW/videoWH+'px'; }else{ // bgVideo.classList.add('video-bg-h'); // bgVideo.classList.remove('video-bg-w'); bgVideo.style.height = windowH+'px'; bgVideo.style.width = windowH*videoWH+'px'; } } } //澶氫釜Ready function addEventReady(fn){ var originFn = document.ready document.ready =function () { originFn && originFn() fn() } } //澶氫釜onload function addEventOnLoad(fn){ var originFn = window.onload window.onload =function () { originFn && originFn() fn() } } //澶氫釜onresize function addEventOnResize(fn){ var originFn = window.onresize window.onresize =function () { originFn && originFn() fn() } } //褰撳墠鏃ユ湡 function presentTime(){ var show_day=new Array('鏄熸湡鏃?,'鏄熸湡涓€','鏄熸湡浜?,'鏄熸湡涓?,'鏄熸湡鍥?,'鏄熸湡浜?,'鏄熸湡鍏?); var time=new Date(); var year=time.getFullYear(); var month=time.getMonth(); var date=time.getDate(); var day=time.getDay(); var hh=time.getHours(); var mm=time.getMinutes(); var ss=time.getSeconds(); month=month+1; month<10?month='0'+month:month; date<10?date='0'+date:date; hh<10?hh='0'+hh:hh; mm<10?mm='0'+mm:hh; ss<10?ss='0'+ss:hh; var now_time=''+year+'骞?+month+'鏈?+date+'鏃?+' '+show_day[day]+''; $('#present-time').html(now_time); } setInterval(presentTime,100); //婊戝姩鐩戝惉 var th,tht; var isScroll = false; $(window).on('touchstart',function(e) { clearInterval(tht); th = 0; }); $(window).scroll(function(e) { if(isScroll){ clearInterval(tht); $('.pf-box').addClass('pf-nav-off'); th = 0; tht = setInterval(function(){ th++; if(th>5){ clearInterval(tht); $('.pf-box').removeClass('pf-nav-off'); clearInterval(tht); } }, 50); }else{ isScroll = true; } }); //tabs鍒囨崲 function tabs(cla,opt){ var obj = this; var oh,nh;//鍒囨崲鍓嶅悗鐨勯珮搴 //opt鎺ュ彈鐨勫弬鏁 var clickEvent = true;//鏄惁鎺ュ彈鐐瑰嚮浜嬩欢 var mouseenterEvent = true;//鏄惁鎺ュ彈榧犳爣缁忚繃浜嬩欢 var fun;//鍒囨崲鍚庣殑鍥炶皟锛宖unction(index){}锛岃繑鍥炲垏鎹㈠悗鐨処NDEX鍊 //鑾峰彇瀹氫箟鍊 if(opt){ clickEvent = opt.clickEvent != null?opt.clickEvent:clickEvent; mouseenterEvent = opt.mouseenterEvent != null?opt.mouseenterEvent:mouseenterEvent; fun = opt.fun?opt.fun:''; } var event =''; clickEvent?event +=' click':''; mouseenterEvent?event +=' mouseenter':''; //榧犳爣瑙﹀彂鍒囨崲浜嬩欢 $(cla).find('.hd>*').on(event,function(e){ //鎵嬫満鐗堥樆姝㈠垏鎹㈡寜閽殑閾炬帴璺宠浆 if(phoneIs()){ stopDefault(e); } if(!$(this).hasClass('on')){ //鑾峰彇鍒囨崲鍚庣殑INDEX var index = $(this).index(); obj.tabsSwitch(index); } }) //tabs鏂规硶 //鍒囨崲鏂规硶 obj.tabsSwitch = function(i){ //鑾峰彇鍒囨崲鍓嶉珮搴 oh = $(cla).find('.e-anim-on').outerHeight(); $(cla).find('.bd').css({'height':oh}); $(cla).find('.hd>*').eq(i).addClass('on').siblings().removeClass('on'); $(cla).find('.bd>.e-anim-on').removeClass('e-anim-on').addClass('e-anim-off'); $(cla).find('.bd>*').eq(i).removeClass('e-anim-off').addClass('e-anim-on'); //鑾峰彇鍒囨崲鍚庨珮搴 nh = $(cla).find('.e-anim-on').outerHeight(); $(cla).find('.bd').css({'height':nh}); $(cla).find('.bd>.e-anim-off').each(function(){ var el = this; animOff(el,{'fun':function(){ $(el).parents('.bd').css({'height':''}); }}) }); //鍒囨崲鍚庡洖璋 fun?fun(i):''; } //鍒濆鍖 $(cla).find('.bd>*').addClass('e-anim-hide'); obj.tabsSwitch(0); } //瀵艰埅 function nav(cla,btn,opt){ //opt鎺ュ彈鐨勫弬鏁 var navWidth = true; if(opt){ navWidth = opt.navWidth; } //绉诲姩绔鑸簨浠 $(btn).click(function(event){ propagation(); //鍥炲埌椤堕儴 $('html,body').animate({scrollTop:0},100); $(btn).toggleClass('nav-btn-show'); if(!$(btn).hasClass('nav-btn-show')){ closeNav() } animSwitch(cla); }); //鎵嬫満鐗堝甫浜岀骇闃绘璺宠浆 $(cla).find('li>a').click(function(e){ if(phoneIs() && $(this).next('.nav-list-sub').length>0){ stopDefault(e); } }) //鎵嬫満鐐瑰嚮瀵艰埅 $('.nav li').click(function(){ if(phoneIs()){ $('.nav-list-sub').css('height',0); $('.nav-list-sub .e-anim-on').each(function(){ animOff(this); }); if($(this).find('.nav-list-sub').length){ $(this).toggleClass('nav-on').siblings().removeClass('nav-on'); } if($(this).hasClass('nav-on')){ animOn($(this).find('.e-anim-hide')); }else{ animOff($(this).find('.e-anim-hide')); } //鑾峰彇楂樺害 var navSubH = $(this).hasClass('nav-on') ? $(this).find('.nav-list-height').outerHeight() : 0; $(this).find('.nav-list-sub').css('height',navSubH); } }); //瀵艰埅鎷︽埅鍐掓场 $('.nav-box').click(function(){ propagation(); }); //闃睮E鎶栧姩 $('.nav-list li .on .nav-btn-bg').css({'width':$('.nav-list .on').parent().outerWidth()}) //PC瀵艰埅榧犳爣缁忚繃 $(cla).find('li').mouseenter(function(){ if(!phoneIs()){ $(cla).find('li').removeClass('nav-on'); $(this).addClass('nav-on').siblings().addClass('nav-off'); if($(this).find('.nav-list-sub').length>0){ animOn($(this).find('.e-anim-hide')); } //瀵艰埅婊戝潡 if($('.nav-list li .on').length >= 1){ $('.nav-list li .on .nav-btn-bg').css({'left':$(this).offset().left-$('.nav-list .on').offset().left,'width':$(this).width()})//涓埆鐗规畩缃戠珯鍙姞鍏ヨ宸慨姝 }else{ $('.nav-btn-bg-02').addClass('nav-btn-bg-02-show').css({'left':$(this).offset().left-$('.nav-list').offset().left-1,'width':$(this).width()}) } if($(this).find('.nav-list-height').length>0){ //浜岀骇涓嬫媺鑳屾櫙鑹 $('.nav-list-sub-bg').addClass('e-animte-show nav-list-sub-bg-show'); } //涓嬫媺鍋忕Щ if(navWidth){ navl(this); } //浜岀骇閫変腑 if($(this).find('.nav-list-sub .on').length){ var subOn = $(this).find('.nav-list-sub .on'); $(this).find('.nav-list-sub .btn-sub-bg').css({'left':subOn.find('span').offset().left-subOn.parent().offset().left,'width':subOn.find('span').width(),'transition-duration':'0s'}) } } }); //PC瀵艰埅榧犳爣绂诲紑 $(cla).find('li').mouseleave(function(){ if(!phoneIs()){ $(this).removeClass('nav-on').siblings().removeClass('nav-off'); $('.nav-list li .on .nav-btn-bg').removeAttr('style'); $('.nav-list li .on .nav-btn-bg').css({'width':$('.nav-list .on').parent().outerWidth()}) if($(this).find('.e-anim-hide').length){ var el = $(this).find('.e-anim-hide'); animOff(el,{fun:function(){ el.parent().css({'width':''}) }}); } //浜岀骇涓嬫媺鑳屾櫙鑹 $('.nav-list-sub-bg').removeClass('e-animte-show nav-list-sub-bg-show'); } $(this).find('.btn-sub-bg').css({'width':'','left':''}) }); //PC瀵艰埅榧犳爣浜岀骇 $(cla).find('.nav-list-sub a').mouseenter(function(){ $(this).parent().find('.btn-sub-bg').css({'left':$(this).find('span').offset().left-$(this).parent().offset().left,'width':$(this).find('span').width(),'transition-duration':''}) }); $('.nav-list').mouseleave(function(){ $('.nav-btn-bg-02').removeClass('nav-btn-bg-02-show').removeAttr('style'); }) } //鏀惰捣瀵艰埅 function closeNav(){ $('.nav-list-sub').css('height',0); $('.nav-list li').removeClass('nav-on'); $('.nav .e-anim-on').each(function(){ animOff(this); }) } //鍒囨崲鍔ㄧ敾 function animSwitch(obj,onOpt,offOpt){ var el; if($(obj).hasClass('e-anim-hide')){ el = $(obj); }else{ el = $(obj).children('.e-anim-hide'); } if(!el.hasClass('e-anim-on')){ animOn(obj,onOpt) }else{ animOff(obj,offOpt) } } //娣诲姞鍔ㄧ敾 function animOn(obj,opt){ var fun; if(opt){ fun = opt.fun?opt.fun:''; } var el; if($(obj).hasClass('e-anim-hide')){ el = $(obj); }else{ el = $(obj).children('.e-anim-hide'); } el.addClass('e-anim-on').removeClass('e-anim-off'); el[0].addEventListener('animationend', function () { //鍥炶皟 fun?fun(obj):''; }); } //绉婚櫎鍔ㄧ敾 function animOff(obj,opt){ var fun; var removeOff = true;//鍔ㄧ敾缁撴潫鍚庢槸鍚︾Щ闄 e-anim-off if(opt){ fun = opt.fun?opt.fun:''; opt.removeOff?removeOff = opt.removeOff:''; } var el; if($(obj).hasClass('e-anim-hide')){ el = $(obj); }else{ el = $(obj).children('.e-anim-hide'); } el.removeClass('e-anim-on').addClass('e-anim-off'); el[0].addEventListener('animationend', function () { //鍥炶皟 if(el.hasClass('e-anim-off')){ fun?fun(obj):''; } removeOff?el.removeClass('e-anim-off'):''; }); } //瀛楃鎴彇 function subStr(str,length){ var a=str.match(/[^\x00-\xff]|\w{1,2}/g); return a.lengthtolh+$(el).outerHeight()){ $(el).css('min-height',$(window).height() - tolh); } $(window).resize(function() { clearTimeout(sizeTimer); sizeTimer = setTimeout(function(){ autoHeight(el,els) },400); }); } //浜屽€嶅浘璁$畻 function image2x(el){ $(el).find('img').each(function(){ if($(this).attr('src').toLowerCase().indexOf('@2x') > -1 ) { $(this).css('width',$(this)[0].naturalWidth/2); } }) $(window).load(function() { image2x(el); }); } //涓婁紶鐨勮棰戞垨寮曞叆澶栭儴瑙嗛 function video(el,opt){ var video = '';//瑙嗛鍦板潃 var poster = '';//灏侀潰鍦板潃 var skin = 'e-video-box';//鑷畾涔夋牱寮 if(opt){ video = opt.video?opt.video:''; poster = opt.poster?opt.poster:''; skin = opt.skin?opt.skin:skin; } //涓婁紶瑙嗛 if(opt.video.toLowerCase().indexOf('mp4') > -1){ var vid = '' }else{ //寮曞叆澶栭儴瑙嗛 var ifr = video.split(" "); for(var i in ifr){ //鍖呭惈iframe if(ifr[i].indexOf('src') > -1){ var src = ifr[i]; break; //绾疷RL }else if( ifr[i].indexOf('//') > -1){ var src = 'src='+ifr[i]; break; } } var vid = '' } $(el).append(vid) } //瑙嗛缈婚〉 function vidBtn(prev,next,num,min,max){ $(prev).show(); $(next).show(); if(num == min){ $(prev).hide(); } if(num == max-1){ $(next).hide(); } } //闃绘鍐掓场浜嬩欢 function propagation(){ if (event.stopPropagation) { // this code is for Mozilla and Opera event.stopPropagation(); } else if (window.event) { // this code is for IE window.event.cancelBubble = true; } } //闃绘璺宠浆 function stopDefault(e) { if ( e && e.preventDefault ) e.preventDefault(); else window.event.returnValue = false; return false; } //闅忔満瀛楀姩鏁 var txtt = []; var sp = []; var tr = []; function txtRandom(cla,time){ $(cla).find('.txt-split').each(function(index){ var that = this; tr[index] = []; if(!$(that).hasClass('txt-split-on')){ sp[index] = $(that).html().split(""); $(that).html('').addClass('txt-split-on'); for(var i in sp[index]){ $(that).append(""+sp[index][i]+""); } } //鑾峰彇闀垮害 $(that).find('span').each(function(ind){ tr[index][ind] = ind; }) //绉婚櫎css $(that).find('span').removeClass('txt-show'); //鍋滄瀹氭椂鍣 clearTimeout(txtt[index]); txtt[index] = setTimeout(function(){ txtCircle(that,tr[index],index,time); },100) }) } //寰幆鍓旈櫎鏂囧瓧 function txtCircle(cla,tr,i,t){ var n = Math.floor(Math.random()*tr.length); //娣诲姞鏍峰紡 $(cla).find('span').eq(tr[n]).addClass('txt-show'); //鏁扮粍鍓旈櫎 tr.splice(n, 1); if(tr.length>0){ txtt[i] = setTimeout(function(){ txtCircle(cla,tr,i,t); console.log(t); },t) } }