// JavaScript Document $(document).ready(function() { new WOW().init(); removeNewsStyle('.news-content'); //瀵艰埅 new nav('.nav','.nav-btn') //浜屽€嶅浘閫傞厤 image2x('.image-2x'); 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); }) }); // 鍏紬鍙 $('.footer-tr dl').hover(function(){ animOn($(this).find('.e-anim-hide')); },function(){ animOff($(this).find('.e-anim-hide')); }); // 鍙嬫儏閾炬帴 $('.footer-br dl').hover(function(){ animOn($(this).find('.e-anim-hide')); },function(){ animOff($(this).find('.e-anim-hide')); }); // 璇█涓嬫媺 $('.lang-box dl').hover(function(){ animOn($(this).find('.e-anim-hide')); },function(){ animOff($(this).find('.e-anim-hide')); }); // PC鎼滅储 // $('.search-btn').mouseenter(function(){ // if(!phoneIs()){ // animOn($('.search')); // } // }) $('.search-btn').click(function(){ if(!phoneIs()){ animSwitch($('.search')); } }) $('.top-r').mouseleave(function(){ if(!phoneIs() && $('.search').hasClass('e-anim-on') && !$('.search').hasClass('search-show')){ animOff($('.search')); } }) $("body").click(function(){ if(!phoneIs() && $('.search').hasClass('e-anim-on')){ $(".search").removeClass('search-show'); animOff($('.search')); } }) $(".search input").focus(function(){ $(".search").addClass('search-show'); }); $(".search input").blur(function(){ $(".search").removeClass('search-show'); }); //鎷涜仒鍔ㄦ€ $('.join-body dt').click(function(){ $(this).next('dd').slideToggle().parents('dl').siblings().find('dd').slideUp(); }) //榧犳爣缁忚繃鍔ㄧ敾 $('.e-anim').hover(function(){ $(this).addClass('anim-on').removeClass('anim-off'); },function(){ $(this).addClass('anim-off').removeClass('anim-on'); }); //瀹炵敤绠€鏄撳垏鎹㈡櫘閫 $('.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(); }) //杩斿洖椤堕儴 $('.top-btn').click(function(){ $('html,body').animate({scrollTop:0}, document.body.scrollHeight/10); }) //娴忚鍣ㄧ増鏈彁绀 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 tht; $(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'); }else{ $('.top-btn').removeClass('top-btn-dn'); } tht = setInterval(function(){ th++; if(th>5){ $('.float-box').removeClass('float-box-hide'); clearInterval(tht); } }, 50); }); 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'; } } } //褰撳墠鏃ユ湡 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;//鍒囨崲鍓嶅悗鐨勯珮搴 //opt鎺ュ彈鐨勫弬鏁 var clickEvent = true;//鏄惁鎺ュ彈鐐瑰嚮浜嬩欢 var mouseenterEvent = true;//鏄惁鎺ュ彈榧犳爣缁忚繃浜嬩欢 var fun;//鍒囨崲鍚庣殑鍥炶皟锛宖unction(index){}锛岃繑鍥炲垏鎹㈠悗鐨処NDEX鍊 var heightAnim = true;//楂樺害鏀瑰彉鍔ㄧ敾 //鑾峰彇瀹氫箟鍊 if(opt){ clickEvent = opt.clickEvent != null?opt.clickEvent:clickEvent; mouseenterEvent = opt.mouseenterEvent != null?opt.mouseenterEvent:mouseenterEvent; fun = opt.fun?opt.fun:''; heightAnim = opt.heightAnim != null?opt.heightAnim:heightAnim; } 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(); if(index < $(cla).find('.bd>*').length){ obj.tabsSwitch(index); } } }) //tabs鏂规硶 //鍒囨崲鏂规硶 obj.tabsSwitch = function(i){ //鑾峰彇鍒囨崲鍓嶉珮搴 if(heightAnim){ oh = $(cla).find('.bd>.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'); //鑾峰彇鍒囨崲鍚庨珮搴 if(heightAnim){ nh = $(cla).find('.bd>.e-anim-on').outerHeight(); $(cla).find('.bd').css({'height':nh}); } //鏄惁鏈夐渶瑕侀殣钘忕殑鍏冪礌 if($(cla).find('.bd>.e-anim-off').length){ $(cla).find('.bd>.e-anim-off').each(function(){ var el = this; animOff(el,{'fun':function(){ $(el).parents('.bd').css({'height':''}); }}) }); }else{ $(cla).find('.bd').css({'height':''}); } //鍒囨崲鍥炶皟 fun?fun(i):''; } //鍒濆鍖 $(cla).find('.bd>*').addClass('e-anim-hide'); obj.tabsSwitch(0); } //瀵艰埅 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()}) //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 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 increase(cla,opt){ //opt鎺ュ彈鐨勫弬鏁 var time = 2000;//鍔ㄧ敾鏃堕暱 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).load(function(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,"); } } function removeNewsStyle(cla){ var p = cla+' p'; var h = cla+' h1, '+cla+' h2, '+cla+' h3, '+cla+' h4, '+cla+' h5, '+cla+' h6'; var span = cla+' span'; var strong = cla+' strong'; var img = cla+' img'; //鏂伴椈杩囨护鏍峰紡 $(p+','+h+','+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).find('img').length == 0){ $(this).attr('data-mess','闅愯棌绌烘牸鍐呭'); $(this).hide(); } }) //鍘绘帀鍥剧墖鐨勬牱寮 $(img).each(function(index,el){ $(this).attr('style',''); $(this).parents('p').addClass('info-box-img'); $(this).parents('p'); //鐗瑰畾鍥剧墖 if($(this).attr('src').split('UEditor').length >= 2){ $(this).addClass('info-box-img-detach'); } }) //鏄剧ず琚闅愯棌鍥剧墖 $('.info-box-img').css('display','block'); //鍘绘帀鍥剧墖闄勮繎鐨勫洖杞 $('.info-box-img br').remove(); //鍘绘帀鏂囧瓧涓甫鏈夌殑绌烘牸 $(p+','+h+','+span+','+strong).each(function(index,el){ $(this).html($(this).html().replace(/ /ig,'')); $(this).html($(this).html().replace(/\n[\s| | ]*\r/g,'')); }) }