// JavaScript Document $(document).ready(function() { new WOW().init(); //浜烘墠鎷涜仒 $('.zxtd-box .list dt').click(function(){ $(this).next().slideToggle(300).parent().toggleClass('show').siblings().removeClass('show').find('dd').slideUp(300); }) /* 浜у搧椤垫爮鐩 */ // 鐐瑰嚮涓€绾ц彍鍗曞睍寮€/鏀惰捣浜岀骇鑿滃崟 /*$('.topmenu > a').click(function() { // 鑾峰彇褰撳墠涓€绾ц彍鍗 var thisTopmenu = $(this).parent(); // 鍒ゆ柇褰撳墠涓€绾ц彍鍗曟槸鍚︽槸婵€娲荤姸鎬 if (thisTopmenu.hasClass('active')) { // 濡傛灉鏄縺娲荤姸鎬侊紝鍒欐敹璧峰綋鍓嶄竴绾ц彍鍗曚笅闈㈢殑浜岀骇鑿滃崟 thisTopmenu.find('.submenu').slideUp(200, function() { thisTopmenu.removeClass('active'); }); } else { // 濡傛灉涓嶆槸婵€娲荤姸鎬侊紝鍒欏厛鏀惰捣鍏朵粬涓€绾ц彍鍗曚笅闈㈢殑浜岀骇鑿滃崟锛屽啀灞曞紑褰撳墠涓€绾ц彍鍗曚笅闈㈢殑浜岀骇鑿滃崟 $('.topmenu.active').removeClass('active').find('.submenu').slideUp(200); thisTopmenu.addClass('active').find('.submenu').slideDown(200); } return false; });*/ //瀵艰埅 new nav('.nav','.nav-btn') 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'); }); // 榧犳爣缁忚繃鎼滅储 $('.search-box').hover(function(){ if(!phoneIs()){ animOn('.search-inp'); } }); $('.nav-list li').hover(function(){ if(!phoneIs() && $('.search-inp').hasClass('e-anim-on')){ animOff('.search-inp'); } }); $('body').click(function(){ if(!phoneIs() && $('.search-inp').hasClass('e-anim-on')){ animOff('.search-inp'); } }); //杩斿洖椤堕儴 $('.top-btn').click(function(){ $('html,body').animate({scrollTop:0}, document.body.scrollHeight/10); }) // 鍥㈤槦 $('.group-list .btn').click(function(){ var _this = this; if($(_this).prev().hasClass('info-box-show')){ $(_this).prev().animate({height:$('.info-box-hide .info-box').height()},function(){ $(_this).prev().removeClass('info-box-show').css('height',''); }); $(_this).removeClass('btn-show'); $(_this).find('span').html('鏇村'); }else{ $(_this).prev().addClass('info-box-show'); $(_this).prev().animate({height:$(_this).prev().find('.cont').height()},function(){ $(_this).prev().css('height','auto'); }); $(_this).addClass('btn-show'); $(_this).find('span').html('鏀惰捣'); } }) //鍔犲叆鎴戜滑 $('.join-body dt').click(function(){ $(this).toggleClass('on').next().slideToggle().parents('dl').siblings().find('dt').removeClass('on').next().slideUp(); }) }); var tht; $(window).scroll(function(e) { }); var sizeTimer = null; $(window).resize(function() { clearTimeout(sizeTimer); sizeTimer = setTimeout(function(){ },400); }); //缃戠珯绫诲瀷 function phoneIs() { if($('.nav-box .container').outerWidth()<960){ return true }else{ return false; } } //鑾峰彇宸﹀亸绉诲€ 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+20); }else{ $(obj).find('.nav-list-sub').css('width',$(obj).find('.nav-list-height').outerWidth()+1); } console.log($('.nav-box .container').width(),lmax); }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'; } } } //褰撳墠鏃ユ湡 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); //tabs鍒囨崲 function tabs(cla,opt){ var obj = this; var oh,nh;//鍒囨崲鍓嶅悗鐨勯珮搴 //鍒囨崲鐨勬牱寮忓悕 var hd = ".hd"; var bd = ".bd"; //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:''; hd = opt.hd != null?opt.hd:hd; bd = opt.bd != null?opt.bd:bd; } var event =''; clickEvent?event +=' click':''; mouseenterEvent?event +=' mouseenter':''; //榧犳爣瑙﹀彂鍒囨崲浜嬩欢 $(cla).find(hd).children().on(event,function(e){ //鎵嬫満鐗堥樆姝㈠垏鎹㈡寜閽殑閾炬帴璺宠浆 if(phoneIs()){ stopDefault(e); } if(!$(this).hasClass('on')){ //鑾峰彇鍒囨崲鍚庣殑INDEX var index = $(this).index(); obj.tabsSwitch(index,true); } }) //tabs鏂规硶 //鍒囨崲鏂规硶 obj.tabsSwitch = function(i,setHeight){ //鑾峰彇鍒囨崲鍓嶉珮搴 oh = $(cla).find(bd).children('.e-anim-on').outerHeight(); //$(cla).find(bd).css({'height':oh}); $(cla).find(hd).children().eq(i).addClass('on').siblings().removeClass('on'); $(cla).find(bd).children('.e-anim-on').removeClass('e-anim-on').addClass('e-anim-off'); $(cla).find(bd).children().eq(i).removeClass('e-anim-off').addClass('e-anim-on'); if(setHeight){ //鑾峰彇鍒囨崲鍚庨珮搴 nh = $(cla).find(bd).children('.e-anim-on').outerHeight(); //$(cla).find(bd).css({'height':nh}); $(cla).find(bd).children('.e-anim-off').each(function(){ var el = this; animOff(el,{'fun':function(){ $(el).parents(bd).css({'height':''}); }}) }); } //鍒囨崲鍚庡洖璋 fun?fun(i):''; } //鍒濆鍖 $(cla).find(bd).children().addClass('e-anim-hide'); obj.tabsSwitch(0,false); } //瀵艰埅 function nav(cla,btn,opt){ //opt鎺ュ彈鐨勫弬鏁 //绉诲姩绔鑸簨浠 $(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()}) $(".nav-list").find('li').mouseenter(function(){ /* alert(123); */ }) //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'); } //涓嬫媺鍋忕Щ 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.length$('.nav-box').outerHeight()+$('.banner-min').outerHeight()+$('.banner-box').outerHeight()+$('.ind-box').outerHeight()+$('.footer-bg').outerHeight()){ $('.ind-box').css('min-height',$(window).height()-$('.nav-box').outerHeight()-$('.banner-min').outerHeight()-$('.banner-box').outerHeight()-$('.footer-bg').outerHeight()); } } //瑙嗛缈婚〉 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; } //鏁板瓧澧炲姞鍔ㄦ晥 function increase(cla,opt){ //opt鎺ュ彈鐨勫弬鏁 var time = 1500;//鍔ㄧ敾鏃堕暱 var obl = false;//鏄惁缁撳悎鍏朵粬鍥炶皟锛岄噸澶嶅姩鐢 var dec = false;//鏄惁鍒嗚妭鍙 //鑾峰彇瀹氫箟鍊 if(opt){ time = opt.time != null?opt.time:time; obl = opt.obl != null?opt.obl:obl; dec = opt.dec != null?opt.dec:dec; } $(window).scroll(function(e) { if(!obl){ numEach(cla); } }) $(window).on('load', function(e) { console.log(e); if(!obl){ numEach(cla); } }) if(obl){ $(cla).each(function(index){ numAnimate(this); }) } //閬嶅巻鍐呭 function numEach(obj){ $(obj).each(function(index){ var t = $(this).offset().top; var st = $(document).scrollTop(); var h = $(window).height(); if(t>st && t1){ le = fl[1].length; } $(obj).text(dec?thousands(now.toFixed(le)):now.toFixed(le)); } }); } } // 鏁板瓧娣诲姞鍒嗚妭鍙 function thousands(num){ var str = num.toString(); var reg = str.indexOf(".") > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g; return str.replace(reg,"$1,"); } }