// JavaScript Document $(document).ready(function() { new WOW().init(); lazyImg('data-lazy'); //瀵艰埅 new nav('.nav','.nav-btn',{'navWidth':false}); // $('body').addClass('body-show'); layui.use('layer', function(){ var layer = layui.layer; //鐩稿唽寮瑰眰 layer.photos({ photos: '#layer-photos' ,anim: 5 //0-6鐨勯€夋嫨锛屾寚瀹氬脊鍑哄浘鐗囧姩鐢荤被鍨嬶紝榛樿闅忔満锛堣娉ㄦ剰锛?.0涔嬪墠鐨勭増鏈敤shift鍙傛暟锛 ,shade: .85 }); }) //璇█ $('.lang-btn dt').click(function(){ if(phoneIs()){ animSwitch('.lang-btn'); } }); $('.lang-btn').mouseenter(function(){ if(!phoneIs() && $(this).find('.e-anim-hide').length){ animOn(this); } }); $('.lang-btn').mouseleave(function(){ if(!phoneIs() && $(this).find('.e-anim-hide').length){ animOff(this); } }); //footer $('.footer-bg .nav-share-btn dl').mouseenter(function(){ if(!phoneIs() && $(this).find('.e-anim-hide').length){ animOn(this); } }); $('.footer-bg .nav-share-btn dl').mouseleave(function(){ if(!phoneIs() && $(this).find('.e-anim-hide').length){ animOff(this); } }); //瀛椾綋澶у皬 var fontSize = ['f-minn','f-min','f-medium','f-max','f-maxx']; $('.font-btn').click(function(){ var i = 0; var fontIs = false; //鍒ゆ柇鍔犲噺 if($(this).hasClass('font-enlarge')){ i = 1; }else{ i = -1; } //鑾峰彇褰撳墠瀛椾綋灏哄 var size = parseInt($('.news-content').attr('data-size')); //鏂板昂瀵 size = size+i; //璧嬪€兼柊鐨勫昂瀵 if( i < 0){ if(size >= 0){ fontIs =true; } }else{ if(size <= fontSize.length-1){ fontIs =true; } } if(size >= fontSize.length-1 || size <= 0){ $(this).addClass('font-btn-off'); }else{ $('.font-btn').removeClass('font-btn-off'); } if(fontIs){ $('.news-content').attr('data-size',size); $('.news-content').removeClass('f-maxx f-max f-medium f-min f-minn').addClass(fontSize[size]); } }) //瀹炵敤绠€鏄撳垏鎹㈡櫘閫 $('.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(){ $(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(); /* tabsRessize(this);*/ }) $('.tabs-box-ord .hd-ord>*').on('mouseenter',function(){ if($(this).parents('.tabs-box-ord').hasClass('tabs-box-enter')){ $(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(); /*tabsRessize(this);*/ } }) //绠€鏄撳垏鎹㈠姩鐢荤増 //閬嶅巻 $('.tabs-box').each(function(){ $(this).find('.hd>*').eq(0).addClass('on'); $(this).find('.bd>*').eq(0).addClass('tabs-on e-animte-show').siblings().addClass('tabs-hide'); $(this).find('.bdl>*').eq(0).show().siblings().hide(); /*$(this).find('.bd').css('height',$(this).find('.tabs-on').outerHeight());*/ }) //鍒囨崲浜嬩欢 $('.tabs-box .hd>*').on('click mouseenter',function(e){ if($('.nav-box .container').outerWidth()<960){ stopDefault(e); } if(!$(this).hasClass('on')){ $(this).parents('.tabs-box').find('.bd>*').removeClass('tabs-on'); $(this).addClass('on').siblings().removeClass('on'); $(this).parents('.tabs-box').find('.bd>*').eq($(this).index()).addClass('tabs-show e-animte-show').removeClass('tabs-hide').siblings().removeClass('tabs-show e-animte-show').addClass('tabs-hide'); $(this).parents('.tabs-box').find('.bdl>*').eq($(this).index()).show().siblings().hide(); /*$(this).parents('.tabs-box').find('.bd').css('height',$(this).parents('.tabs-box').find('.tabs-show').outerHeight());*/ } }) //绐楀彛鏀瑰彉閲嶇疆澶у皬 $(window).resize(function() { setTimeout( function(){ /* $('.tabs-box').each(function(){ if($(this).find('.e-animte').hasClass('tabs-on')){ $(this).find('.bd').css('height',$(this).find('.tabs-on').outerHeight()); }else{ $(this).find('.bd').css('height',$(this).find('.tabs-show').outerHeight()); } })*/ }, 300 );//寤惰繜閲嶇疆鍏煎swiper2.x }); //婊戝姩鐩戝惉 var th,tht; $(window).on('touchstart',function(e) { clearInterval(tht); th = 0; }); $(window).scroll(function(e) { clearInterval(tht); $('.float-box').addClass('float-box-hide'); th = 0; if($(window).height()>$(document).scrollTop()){ $('.top-btn').addClass('top-btn-dn'); $('.message-info').addClass('message-info-min'); }else{ $('.top-btn').removeClass('top-btn-dn'); $('.message-info').removeClass('message-info-min'); } tht = setInterval(function(){ th++; if(th>5){ clearInterval(tht); $('.float-box').removeClass('float-box-hide'); clearInterval(tht); } }, 50); }); //闃绘璺宠浆 $('.copy-btn').click(function(){ var e = $(this).attr('data-copy'); $(e).select(); // 閫夋嫨瀵硅薄 document.execCommand("Copy"); // 鎵ц娴忚鍣ㄥ鍒跺懡浠 layer.msg('澶嶅埗閭鎴愬姛锛?,{time:1000}); }); //搴曢儴鍒嗕韩鎸夐挳 $('.share-btn').mouseenter(function(){ $(this).find('.e-animte').addClass('e-animte-show footer-btn-mess-show'); }) $('.share-btn').mouseleave(function(){ $(this).find('.e-animte').removeClass('e-animte-show footer-btn-mess-show'); }) //娴忚鍣ㄧ増鏈彁绀 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); } }); var sizeTimer = null; //娴忚鍣ㄧ増鏈垽鏂 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"; } } //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(); } //闃绘鍐掓场浜嬩欢 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; } //璁惧妯珫灞忓垽鏂 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); //鍥剧墖鎳掑姞杞 var inum; var inums = []; function lazyImg(lazyName) { inum = '['+lazyName+']'; $(inum).attr('src','data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'); //閬嶅巻鍥剧墖 for(var i = 0 ; i < $(inum).length; i++){ //閬嶅巻鐖剁骇璁$畻鎬婚珮搴 var top = $(inum)[i].offsetTop; var parent = $(inum)[i].offsetParent; while(parent != null) { 銆€銆€銆€銆€top += parent.offsetTop; 銆€銆€銆€銆€parent = parent.offsetParent; 銆€銆€ } //閬嶅巻鐖剁骇鏄惁闅愯棌 var showIs = true; var pp = $(inum).eq(i).parent(); while($(pp)[0].tagName != "HTML"){ if(!$(pp).is(':visible')){ showIs = false; } pp = $(pp).parent(); } inums.push({"num":i,"obj":inum,"src":$(inum).eq(i).attr(lazyName),"top":top,"height":top+$(inum).eq(i).height(),"showIs":showIs}); } uqImg(); setTimeout(function(){uqImg()},1000); $(window).scroll(function() { uqImg(); }); } //鏇存柊鍥剧墖 function uqImg(){ var wt = $(document).scrollTop(); var wh = $(document).scrollTop()+$(window).height(); for(var i in inums){ if(inums[i].top > wt && inums[i].top < wh && inums[i].showIs){ $(inum).eq(inums[i].num).attr('src',inums[i].src); inums.splice(i,1); } } for(var i in inums){ if(inums[i].height > wt && inums[i].height < wh && inums[i].showIs){ $(inum).eq(inums[i].num).attr('src',inums[i].src); inums.splice(i,1); } } for(var i in inums){ if(inums[i].top < wt && inums[i].height > wh && inums[i].showIs){ $(inum).eq(inums[i].num).attr('src',inums[i].src); inums.splice(i,1); } } } //瑙嗛鑳屾櫙灞呬腑 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 nav(cla,btn,opt){ //opt鎺ュ彈鐨勫弬鏁 var navWidth = true; if(opt){ navWidth = opt.navWidth; } if($('.nav-list li .on').length == 0){ $('.nav-list li').eq(0).find('a').addClass('on'); } //绉诲姩绔鑸簨浠 $(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 (e) { if(e.target === this){ //鍥炶皟 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 (e) { if(e.target === this){ //鍥炶皟 fun?fun(obj):''; removeOff?el.removeClass('e-anim-off'):''; } }); } //鑾峰彇宸﹀亸绉诲€ 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; } } //缃戠珯绫诲瀷 function phoneIs() { if($('.nav-box .container').outerWidth()<960){ return true }else{ return false; } } //绉婚櫎鏍峰紡 function removeNewsStyle(cla){ var p = cla+' p'; var span = cla+' span'; var strong = cla+' strong'; var img = cla+' img'; //鏂伴椈杩囨护鏍峰紡 $(p+','+span+','+strong).each(function(index,el){ //杩囨护鏍峰紡 var ta = $(this).css("text-align"); var col = $(this).css("color"); $(this).removeAttr('style'); $(this).css('text-align',ta); $(this).css('color',col); //灞呬腑鍘绘帀缂╄繘 if(ta == "center"){ $(this).addClass('info-box-ti0'); } //绌哄唴瀹归殣钘 if($(this).text() == '' && $(this).find('img').length == 0){ $(this).attr('data-mess','闅愯棌鍥剧墖'); $(this).hide(); } //鍙湁绌烘牸闅愯棌 if($(this).text().match(/^\s+$/)){ $(this).attr('data-mess','闅愯棌鍐呭'); $(this).hide(); } }) //鍘绘帀鍥剧墖鐨勬牱寮 $(img).each(function(index,el){ $(this).attr('style',''); $(this).parents('p').addClass('info-box-img'); $(this).parents('p'); }) //鏄剧ず琚闅愯棌鍥剧墖 $('.info-box-img').css('display','block'); //鍘绘帀鍥剧墖闄勮繎鐨勫洖杞 $('.info-box-img br').remove(); //鍘绘帀鏂囧瓧涓甫鏈夌殑绌烘牸 $(p+','+span+','+strong).each(function(index,el){ $(this).html($(this).html().replace(/ /ig,'')); $(this).html($(this).html().replace(/\n[\s| | ]*\r/g,'')); }) }