/*! Project : 閲戞磱楂樻柊鎶€鏈紑鍙戞湁闄愬叕鍙 +-----YL.js-V-2020.10.19-----+ | | | Author | yeshiqiu | | Q__Q | 337676937 | | Addr | SC_Chengdu | | Date | 2020.10.19 | | | +--!-_-!--------------!-_-!--+ */ //**!!**Modernizr (Custom Build) | MIT * 鑷畾涔 ysqUEO supports chrome Safari svgable bCanvas !function(e,n,t){function r(e,n){return typeof e===n}function s(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):S?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function o(e,t,r,o){var i,a,l,f,u="modernizr",c=s("div"),d=function(){var e=n.body;return e||(e=s(S?"svg":"body"),e.fake=!0),e}();if(parseInt(r,10))for(;r--;)l=s("div"),l.id=o?o[r]:u+(r+1),c.appendChild(l);return i=s("style"),i.type="text/css",i.id="s"+u,(d.fake?d:c).appendChild(i),d.appendChild(c),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(n.createTextNode(e)),c.id=u,d.fake&&(d.style.background="",d.style.overflow="hidden",f=g.style.overflow,g.style.overflow="hidden",g.appendChild(d)),a=t(c,e),d.fake?(d.parentNode.removeChild(d),g.style.overflow=f,g.offsetHeight):c.parentNode.removeChild(c),!!a}function i(e,n){return!!~(""+e).indexOf(n)}function a(e){return e.replace(/([a-z])-([a-z])/g,function(e,n,t){return n+t.toUpperCase()}).replace(/^-/,"")}function l(e,n){return function(){return e.apply(n,arguments)}}function f(e){return e.replace(/([A-Z])/g,function(e,n){return"-"+n}).replace(/^ms-/,"-ms-")}function u(n,r){var s=n.length;if("CSS"in e&&"supports"in e.CSS){for(;s--;)if(e.CSS.supports(f(n[s]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var i=[];s--;)i.push("("+f(n[s])+":"+r+")");return i=i.join(" or "),o("@supports ("+i+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return t}function c(e,n,o,l){function f(){d&&(delete E.style,delete E.modElem)}if(l=!r(l,"undefined")&&l,!r(o,"undefined")){var c=u(e,o);if(!r(c,"undefined"))return c}for(var d,p,m,v,h,y=["modernizr","tspan"];!E.style;)d=!0,E.modElem=s(y.shift()),E.style=E.modElem.style;for(m=e.length,p=0;m>p;p++)if(v=e[p],h=E.style[v],i(v,"-")&&(v=a(v)),E.style[v]!==t){if(l||r(o,"undefined"))return f(),"pfx"!=n||v;try{E.style[v]=o}catch(e){}if(E.style[v]!=h)return f(),"pfx"!=n||v}return f(),!1}function d(e,n,t,s,o){var i=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+T.join(i+" ")+i).split(" ");return r(n,"string")||r(n,"undefined")?c(a,n,s,o):(a=(e+" "+_.join(i+" ")+i).split(" "),function(e,n,t){var s;for(var o in e)if(e[o]in n)return!1===t?e[o]:(s=n[e[o]],r(s,"function")?l(s,t||n):s);return!1}(a,n,t))}function p(e,n,r){return d(e,t,t,n,r)}var m=[],v=[],h={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){v.push({name:e,fn:n,options:t})},addAsyncTest:function(e){v.push({name:null,fn:e})}},y=function(){};y.prototype=h,y=new y;var g=n.documentElement,S="svg"===g.nodeName,C="CSS"in e&&"supports"in e.CSS,w="supportsCSS"in e;y.addTest("ysqUEO",function(){return p("transform","scale(1)",!0)}),y.addTest("supports",C||w),y.addTest("chrome",function(){return navigator.userAgent.indexOf("Chrome")>-1}),y.addTest("bCanvas",function(){var e=document.createElement("canvas");return!!e.getContext&&!!e.getContext("2d")}),y.addTest("Safari",function(){return MacTest()}),y.addTest("svgable",function(){return!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect}),h.testStyles=o;var x="Moz O ms Webkit",T=h._config.usePrefixes?x.split(" "):[];h._cssomPrefixes=T;var _=h._config.usePrefixes?x.split(" "):[];h._domPrefixes=_;var b={elem:s("modernizr")};y._q.push(function(){delete b.elem});var E={style:b.elem.style};y._q.unshift(function(){delete E.style}),h.testAllProps=d,h.testAllProps=p,function(){var e,n,t,s,o,i,a;for(var l in v)if(v.hasOwnProperty(l)){if(e=[],(n=v[l]).name&&(e.push(n.name),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t0){ysq.IsMoble=!0;break} }; Touchable = "ontouchstart" in window && ysq.IsMoble && !(/hp-tablet/gi.test(navigator.appVersion)); if(Touchable){TouchOn = "touchstart", TouchIng = "touchmove", TouchEd = "touchend"; TouchEnter = TouchEd; }else {TouchOn = "mousedown", TouchIng = "mousemove", TouchEd = "mouseup"; TouchEnter = "mouseenter"; } $h.addClass(ysq.IsMoble?"wap":"pc");ysq.Switch&&(ysq.Switch=!navigator.userAgent.match("MicroMessenger")); ysq.Switch&&(_delay=1800,document.documentElement.firstElementChild.appendChild(document.createElement('style')).innerHTML=ysq.wrap+"{opacity:0.67} [scrollEle],[swAnimate]{visibility: hidden;}"); setTimeout(function(){$(ysq.wrap).hasClass('show')||(ysq.htmlInit(),ysq.Switch=!1)},_delay);hvGet(); } }; ysq.basic(); // 鍔ㄦ€佸瓧鍙?0200810 !function(e,t){function i(){var t=a.getBoundingClientRect().width,i=parseInt(window.screen.width),r=ysq.MinW,n=Math.min(i,r)/r,o="width="+(r>i?r:"device-width")+", minimum-scale = "+n+", maximum-scale = "+n+", initial-scale = "+n+", target-densitydpi=device-dpi";document.querySelector('meta[name="viewport"]').setAttribute("content",o),t/m>ysq.MaxW&&(t=ysq.MaxW*m);var s=t/7.5;a.style.fontSize=s+"px",l.rem=e.rem=ysq.rem=s,ysq.resetFs=function(t){1.2*window.getComputedStyle(a).fontSize.split("p")[0]=3&&(!m||m>=3)?3:v>=2&&(!m||m>=2)?2:1:1)}if(a.setAttribute("data-dpr",m),!o)if((o=n.createElement("meta")).setAttribute("name","viewport"),d=ysq._dpr||d,o.setAttribute("content","initial-scale="+d+", maximum-scale="+d+", minimum-scale="+d+", user-scalable=no"),a.firstElementChild)a.firstElementChild.appendChild(o);else{var w=n.createElement("div");w.appendChild(o),n.write(w.innerHTML)}e.addEventListener("resize",function(){clearTimeout(r),r=setTimeout(i,1)},!1),e.addEventListener("pageshow",function(e){e.persisted&&(clearTimeout(r),r=setTimeout(i,1))},!1),e.addEventListener("DOMContentLoaded",function(e){i(),l.dpr=e.dpr=m,l.refreshRem=i},!1),i(),l.dpr=e.dpr=m,l.refreshRem=i,l.rem2px=function(e){var t=parseFloat(e)*this.rem;return"string"==typeof e&&e.match(/rem$/)&&(t+="px"),t},l.px2rem=function(e){var t=parseFloat(e)/this.rem;return"string"==typeof e&&e.match(/px$/)&&(t+="rem"),t}}(window,window.lib||(window.lib={})); /*baseFn*/ $(document).ready(function(){ if(ysq.IsMoble){FastClick.attach(document.body);} // fn-Run ;(function($){ SuitSet(); w.Y_InitSet().Y_ScrollEle(); // $(".pof-s").prependTo($b); // $(".pof-e").appendTo($b); //Re-Orientation ResizeD(function() {$(ysq.wrap).removeClass('show');setTimeout(function(){SuitSet();ysq.htmlInit();w.resize(); },200);}); })(jQuery); // window.addEventListener("unload",function(){window.scrollTo(0,0);}); function SuitSet() { GotWH(); hvGet(); } /*load*/ w.load(function() {fnLazyloadPd($b)&&$.fn.Y_LazyLoad.Init($b,!1); }); w.trigger('resize').trigger('scroll.unTriggered'); }); /*鎵╁睍缁勪欢*/ $.fn.extend({ Y_InitSet: function() { ysq.TT&&console.log("鍔犺浇鏃堕棿:"+(new Date().getTime()-ysq.TT)+"ms"); w.load(function() {console.log("\n%c鎶€鏈敮鎸侊細鎴愰兘浠婄綉绉戞妧\n https://www.28jw.cn/\n \~\/\^\_\^\\\~ \n","color:#53b753;font-weight:700;font-size:12px;"); }); /*load*/ w.on('scroll', function(event) { $('.Y_AutoCheck').each(function(i,oE) { oE.fnAuto.call(this); }); }) .load(function() {fnLazyloadPd($b)&&$.fn.Y_LazyLoad.Init($b,!1); setTimeout(function(){fnLazyloadPd($b)&&$.fn.Y_LazyLoad.Init($b,!1); },500);}) .trigger("scroll").trigger('resize'); /*scroll_EVENT*/ /*notPointerNone ---? 鍙栨秷褰撳墠椤甸潰鐨刾ointerNone*/ // w.on("scroll.PointerNone",function(){if($(".notPointerNone").length){return;}$b.addClass("_pen"); clearTimeout($b[0].scrollTimer);$b[0].scrollTimer=setTimeout(function(){$b.removeClass("_pen");},200);}); /*a[null]click*/ $b.delegate("a",'click',function(event){if("#"==$(this).attr("href")||isNull($(this).attr("href")))return prevent_default(event);}); $(".backToHistory").click(function(){window.history.go(-1);}); var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; } if(!window.requestAnimationFrame)window.requestAnimationFrame=function(callback){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime||0));var timeFn=window.setTimeout(function(){callback(currTime+timeToCall);},timeToCall);lastTime=currTime+timeToCall;return timeFn;}; if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(id){clearTimeout(id);}; setTextLine($("[data-text-line]")); /*ActiveEle*/ (ysq.UEO||ysq.IsMoble)&&$("[ActiveEle]").each(function(s,t){$(t).addClass("ActAni").on('click.ActAni',function(){var $oE=$(this),s=$oE.attr("ActiveEle");$oE.hasClass("animated")||$oE.hasClass(s)||($oE.addClass(s),setTimeout(function(){$oE.removeClass(s)},getAniDur($oE)))})}); (ysq.UEO)&&$("[swAnimate]").each(function(i,oE){ var $this=$(oE),_animation=$this.attr("swAnimate")||"fainInUp", _step=$this.attr("swStep")?(new String($this.attr("swStep")).split(",")):[300,133]; w.on('scroll.Y_swAnimate', function(event) { if(inWindow($this)){$this.Y_swAnimate({animation:_animation,interval:_step}).removeAttr('swAnimate');} }).trigger('scroll.Y_swAnimate'); }); return this;} ,Y_ScrollEle: function(opt) { /** * @parame [scrollEle:(a:animation)|(b:team)|(c:parent)] * @parame [scrollArray:(a,b:animation)|(c:animation-array)] * @parame [scrollDir:(animation-direction(ltr-rtl))] * @parame [scrollWait:(寰呭懡:$.fn.Y_ScrollEle.Do鏃舵墽琛?] * @parame [scrollStep:(animation-StepTime)] * @parame [scrollDir:榛樿ltr -> rtl 鏃跺€欎細鍙嶅悜] * @parame [scrollStayCls:鎺у埗涓嶆竻闄lass->閬垮厤鏌愪簺鍔ㄧ敾缁撴潫鏃跺€檅ug] * @parame [scrollCbk[@num]:callback] @num:delay鍊嶆暟(0~1) * @parame [scrollDelay:(delay-run)] * @parame [scrollColumns:scrollArray ] * @parame [responsive:鍝嶅簲寮廬 * @parame [scrollCount:閾惧紡countup] * @parame [scrollArray=aniSerialize:榛樿瀵逛笅绾у厓绱犲鍔燾bk鍏冪礌] * @parame [ResAnimation:max1024榛樿animation] * @parame [scrollMAni:鎵嬪姩璁剧疆鍏冪礌max1024-animation] * @parame [scrollDelayArray:(parent==>c=>delay)鍔ㄦ€佸彇鍒梋 * @parame [$["scrollEle"].parents(".hide-block"):(鐖剁骇display:none鍒欎笉杩愬姩)] * @$.fn.Y_ScrollEle.Do(obj) [fullScreen_section:鏀寔1灞忓紡杩愬姩] * @$.fn.Y_ScrollEle.Init(obj) [reset AniDo杩愬姩鏉′欢] */ if(!ysq.Switch){return ysq.htmlInit(),this}; var def={err:[w.height()/5,w.height()/6],delay:200,fullScreen:!1,responsive:!1,ResAnimation:"fadeInDowns"};opt=$.extend({},def,opt); var array=[],sExcept="[scrollEle],br",sBaseCls='AniDo',$this=this , SE_Checkout = function(oE, $Contain, delay) { if (isNull($(oE).attr("scrollEle"))) { return (cw("notScrollEle:" + sElements($(oE))),$(oE).removeAttr("scrollEle"), !1); } else if ($(oE).is(":hidden")) { return (ysq.TT && cw("hidden:" + sElements($(oE))), !1); } else if (opt.fullScreen || ($Contain != $b&&inWindow($(oE),opt.err))) { return ($.fn.Y_ScrollEle.SE_Animate($(oE), delay), !1); } else { return !0; } }, SE_Destroy = function($e, sCls, delay) { $e.on("destroy.Y_ScrollEle",function(){ clearTimeout($e[0].timer1) clearTimeout($e[0].timer2) $(this).off("destroy.Y_ScrollEle"); var sRemCls = $e.data("scReset") ? "AniDoing" : "AniDo AniDoing"; $e.removeAttr('scrollNext').removeClass(sCls).parent().add($e).removeClass(sRemCls); // opt.fullScreen || $e.removeAttr('scrollArray'); // $e.removeClass("AniStart AniDid") }); delay = getAniDur($e) + (delay||0) ; $e[0].timer1=setTimeout(function() { $e.attr("scrollCbk") && ($e.addClass("AniDid")); if($('.numCountUp .num',$e).length&&$e.hasClass('scrollCount')){ var oNum = $('.numCountUp .num',$e)[0]; var numStart = new CountUp(oNum, $(oNum).attr("data-startVal")||0, $(oNum).attr("data-endVal"), getDecimals($(oNum).attr("data-endVal")).length, 1.2,{useEasing:!0}); setTimeout(function(){numStart.start(); },(parseInt($(oNum).parents('.numCountUp').attr("data-delay"))||150) ); } }, $e.attr("scrollCbk")/1*delay); $e[0].timer2=setTimeout(function() {$e.trigger("destroy.Y_ScrollEle"); }, delay); }, SE_RemoveScrollEle=function($e){$e.attr("scrollEle-temp",$e.attr("scrollEle")).removeAttr("scrollEle"); }, SE_SetDelay=function($e,_delay){$e.children().not("br").each(function(iz, ez) {$(ez).attr("scrollDelay", 150+iz%($e.attr("scrollColumns")||Math.round($e.outerWidth()/getW($(ez))))*_delay); }); }; $.fn.Y_ScrollEle.SE_Reset = function($e) {$('[scrollEle-temp]',$e).add($e).each(function(i,e){$(e).attr("scrollEle",$(e).attr("scrollEle-temp")).removeAttr("scrollEle-temp"); }); }; $.fn.Y_ScrollEle.SE_Animate = function($e,delay) { if(isNull($e.attr("scrollEle")) || $e.is(":hidden") || $e.attr("scrollWait")=="1" || !isNull($e.attr("lazy-src"))){ return /*ysq.TT&&cw($e),*/!0;} $e.hasClass(sBaseCls)||$e.addClass(sBaseCls); var sAniEle=$e.attr("scrollEle"),dir=$e.attr("scrollDir")||"ltr",_delay=$e.attr("scrollDelay")||0; if(delay){_delay=delay*(delay>0?$e.index():($e.index()-$e.parent().children().length)); } if (sAniEle == 'team') { var nStepTime=$e.attr("scrollStep")||150; sAniEle=SE_GetAniName($e.attr("scrollArray")); // $.isArray(sAniEle)?sAniEle[iy%(sAniEle.length)]:sAniEle // if(!$.isArray(sAniEle)){var _temp=sAniEle; sAniEle=[]; sAniEle.push(_temp); } // if(!!$e.attr("scrollNext")){return ;} var $C=$e.children().not(sExcept), nC=$C.length, bSolo=$e.attr("scrollSolo")==1||sAniEle.length==1; $C.addClass(sBaseCls); setTimeout(function(){ $e.addClass('AniDoing').attr("scrollArray")=="aniSerialize"||!!$e.attr("scrollCbk")&&$C.attr("scrollCbk",$e.attr("scrollCbk")||1); $C.each(function(i, e) { var nIdx=dir=="ltr"?i:(nC-(i+1)); e.sAniName=sAniEle[nIdx%sAniEle.length]; setTimeout(function(){ $(e).addClass(e.sAniName+" AniDoing").data("scReset",!1) .attr("scrollCbk")&&$(e).addClass("AniStart"); !!$e.attr("scrollStayCls")||SE_Destroy($(e),e.sAniName); },$(e).attr("scrollDelay")||(50+nStepTime*(bSolo?nIdx:1)) ); }); SE_RemoveScrollEle($e); },_delay); } else { $e.addClass(sBaseCls).hasClass(sAniEle)||setTimeout(function(){ $e.addClass(sAniEle+" AniDoing").data("scReset",!1).attr("scrollCbk")&&$e.addClass("AniStart"); SE_RemoveScrollEle($e);SE_Destroy($e, sAniEle); }, _delay); }; fnLazyloadPd($e)&&$.fn.Y_LazyLoad.Init($e,!0,0,!0); }; $.fn.Y_ScrollEle.Do = function($obj,array_Step,bNoWait) { $obj=$obj||$b; if(ysq.shutDown){return;} /* $obj 閽堝鍏冪礌鎴栨寚瀹歜ody */ bNoWait&&$("[scrollWait]",$obj).removeAttr('scrollWait'); // scrollDelayArray $("[scrollDelayArray]").each(function(i, e) { SE_SetDelay($(e),$(e).attr('scrollDelayArray')||125) ;}); // array搴忓垪澶勭悊 if(array.length){ var step=0; $.each(array,function(iy,ey){ ysq.TT&&cw("Y_ScrollEle_Step:"+step); step+=iy==0?0:(getAniDur($(ey))/3||200); setTimeout(function(){ $.fn.Y_ScrollEle.SE_Animate($(ey)); $(ey).is('[scrollNext]')&&w.trigger('scroll.Y_scrollEle'); },step); });array=[]; }else{ $("[scrollEle]",$obj).add($obj.is("[scrollEle]")).each(function(i,e){ // c(SE_Checkout(e,$obj,array_Step)&&inWindow($(e),opt.err)) // c(SE_Checkout(e,$obj,array_Step)) SE_Checkout(e,$obj,array_Step)&&inWindow($(e),opt.err)&&$.fn.Y_ScrollEle.SE_Animate($(e)); }); } }; $.fn.Y_ScrollEle.Init = function ($obj) { $obj=$obj||$b; $("[scrollEle]",$obj).children().add($obj.is("[scrollEle]")).data("scReset",!0); $("[scrollNext]",$obj).each(function(i,e) { // c(i) var _ani=SE_GetAniName($(e).attr("scrollNext")); $(e).children().not(sExcept).attr("scrollCbk",$(e).attr("scrollCbk")).each(function(ix,ex) { $(ex).attr("scrollEle", _ani[ix%_ani.length]) });; SE_SetDelay($(e),$(e).attr('scrollDelayArray')||125) ; }); $("[scrollEle]",$obj).each(function(i,e) { var sAniEle=$(e).attr("scrollEle"); (sAniEle=='team'||sAniEle=='parent')?$(e).addClass(sBaseCls).children().not(sExcept).addClass(sBaseCls):$(e).addClass(sBaseCls);}); }; opt.responsive&&!MinWidth(1024)&&$("[scrollEle]").each(function(i,e) { var sAniEle=$(e).attr("scrollEle"),sAniName=$(e).attr("scrollMAni")||opt.ResAnimation; if(sAniEle=='team'||sAniEle=='parent'){$(e).attr("scrollArray",sAniName);}else{$(e).attr("scrollEle",sAniName);} }); opt.fullScreen?ysq.htmlInit():setTimeout(function(){ysq.htmlInit(); var $obj=$b; $("[scrollEle]").each(function(i, e){ SE_Checkout(e,$obj,opt.delay) && (!isHidden($(e))&&$(e).parents('[scrollEle]').add($(e)).length) && inWindow($(e),opt.err) && (array.push($(e))); }); $.fn.Y_ScrollEle.Init(); w.on('scroll.Y_scrollEle',function(){$.fn.Y_ScrollEle.Do($obj)}).trigger('scroll.Y_scrollEle'); },opt.delay); return this; } ,Y_swAnimate:function(opt){ // $('.sOrigin-lead .contain p').attr({'swAnimate': ['fadeInUpm','fadeInDownm'],swStep:[100,100]}); // (ysq.UEO)&&$("[swAnimate]").each(function(i,oE){ // var $this=$(oE),_animation=$this.attr("swAnimate")||"fainInUp", // _step=$this.attr("swStep")?(new String($this.attr("swStep")).split(",")):[300,133]; // w.on('scroll.Y_swAnimate', function(event) { // if(inWindow($this)){$this.Y_swAnimate({animation:_animation,interval:_step}).removeAttr('swAnimate');} // }).trigger('scroll.Y_swAnimate'); // }); if(!ysq.Switch){return this.removeAttr('swAnimate'),this; }; var def={animation:'fadeInUp',interval:[300,133],va:"vat"};opt=$.extend({},def,opt); this.each(function(i,oE) { var $this=$(oE); $this.attr("swAnimate-temp",opt.animation); if(!$this.hasClass('_ed')){ var $line=$this.find('>p').length?$this.find('>p'):$this; var _delay=$this.attr("swDelay")?$this.attr("swDelay")/1:333; var _backup=$this.html(); // $this.attr("scrollEle","animateStay"); $line.each(function(ix,ex) { var _str=$(ex).html(),sText="",_cls="dib AniDo "+opt.va; $(ex).html(""); for(var j=0;j<_str.length;j++){ if((j+1)==_str.length&&((_str.charAt(j)=="\r")||(_str.charAt(j)=="\n"))){ } else if(_str.charAt(j)===" "&&_str.charAt(j+1)!==" "){ //鍒ゆ柇杩炵画绌烘牸 sText+=" "; } else{ sText+=""+_str.charAt(j)+""; } } $(ex).html(sText); setTimeout(function(){$this.removeAttr('swAnimate'); },1); if(opt.animation=="none"){ $(".dib",ex).removeClass('AniDo'); } else{ var _aniName=SE_GetAniName(opt.animation); setTimeout(function(){ $(ex).find('.dib').each(function(iy,ey) { setTimeout(function(){ $(ey).addClass('AniDoing').addClass($.isArray(_aniName)?_aniName[iy%(_aniName.length)]:_aniName); if(ix==$line.length-1 && iy==$(ex).find('.dib').length){ setTimeout(function(){ $this.removeAttr('swAnimate'); },200); } },iy*opt.interval[1]); }); },_delay+ix*opt.interval[0]); } }); $this.addClass('_ed').append(''+_backup+''); this.swAnimate_reset=function(){$(this).attr("swAnimate",$(this).attr("swAnimate-temp")).removeClass("_ed").html($('._backup',this).html()); } } });return this; } ,Y_LoadImg: function(opt){ var def={imgSrc:null,delay:50,cls:".picBox,.pic,.img",callback:null}; opt=$.extend({},def,opt); this.attr("scrollWait","1").each(function(i,oE) {var $lazy=$(oE),sImgSrc=opt.imgSrc; if(ysq.TT){sImgSrc+="?time="+new Date().getTime();} if (!$lazy.is("img")) { sImgSrc && $lazy.css("background-image", "url(" + sImgSrc + ")").addClass('Loaded').removeAttr('scrollWait'); } else {$lazy.attr("src", sImgSrc || ""); if ($lazy.parents(opt.cls).length) { var baseDelay = opt.delay , baseTime = new Date().getTime(); var destroyCls = function(){ var delay = baseDelay - (new Date().getTime() - baseTime); $lazy.addClass("destroying"); setTimeout(function() { $lazy.parents(opt.cls).addClass('imgLoaded loadDone').removeClass("loading").removeClass("loading-m"); $lazy.hasClass("AniDo") || $lazy.addClass("Done"); $lazy.addClass("Loaded"); setTimeout(function() { $lazy.removeClass('lazyimg Done').removeAttr('scrollWait'); ysq.Switch&&$.fn.Y_ScrollEle.SE_Animate&&$.fn.Y_ScrollEle.SE_Animate($lazy); }, parseFloat($lazy.css("transition-duration")) * 1e3 || 1); opt.callback&&opt.callback.call(this); $lazy.removeClass("destroying"); }, Math.max(delay,1)); } $lazy.load(function(e) { destroyCls(); }).error(function(e) { /*loadOnce:浜屾鍔犺浇*/ if (!$lazy.data("loadOnce")) {$lazy.data("loadOnce", !0); $lazy.attr("src", sImgSrc || ""); } else { $lazy.parents(opt.cls).removeClass("loading").removeClass("loading-m") $lazy.attr("data-default")?$lazy.attr("src",$lazy.attr("data-default")).addClass('default'):$lazy.parents(opt.cls).addClass("load-error loadDone"); opt.callback&&opt.callback.call(this); } }); // destroyCls(); $lazy.hasClass("destroying")||setTimeout(function(){ destroyCls(); },5000); } else {$lazy.removeClass('lazyimg').addClass("Loaded").removeAttr('scrollWait');opt.callback&&opt.callback.call(this); ysq.Switch&&$.fn.Y_ScrollEle.SE_Animate&&$.fn.Y_ScrollEle.SE_Animate($lazy);;} };$lazy.removeAttr("lazy-src"); });return this;} ,Y_LazyLoad: function() { $.fn.Y_LazyLoad.Init=function(obj,bLoadAll,delay,ofst){ var $this=obj;bLoadAll=!!bLoadAll; //$this:鍔犺浇$this鍐呯殑鎵€鏈塴azy ;bLoadAll:涓€娆℃€у姞杞 // ysq.LoadImgArray = $.isArray(ysq.LoadImgArray)?ysq.LoadImgArray:[]; ysq.LoadImgArray=[]; if(ysq.shutDown||!$("[lazy-src]",$this).length){return;} if(MacTest()){$("[lazy-src]",$this).attr("src",function(){ return $(this).attr('lazy-src')}).removeAttr('lazy-src') .error(function() {$(this).parents(".picBox,.pic,.img").addClass("load-error loadDone");}) .parents(".picBox,.pic,.img").addClass('imgLoaded loadDone'); return; } $("[lazy-src]",$this).each(function(i,oImg){ isNull($(oImg).attr("lazy-src"))&&$(oImg).attr("lazy-src",'none'); if($(oImg).hasClass('loaded')||(!$(oImg).is('img'))){ inWindow($(oImg),[-w.height()/3,-w.height()/3])&&$(oImg).Y_LoadImg({imgSrc:$(oImg).attr("lazy-src")}); } else{ $(oImg).hasClass("AniDo")||$(oImg).addClass("lazyimg"); if(!$(oImg).hasClass('_lz')&&(bLoadAll||(!$(oImg).parents(".waitLoad").length&&!isHidden($(oImg))&&inWindow($(oImg),[w.height()/10,w.height()/10])))){ $(oImg).addClass('_lz').parents(".picBox,.pic,.img").addClass(function(){ return $(this).outerWidth()<150?"loading-m":"loading";}); ysq.LoadImgArray.push(oImg); c('push') } } });loadImg(ysq.LoadImgArray,0); function loadImg(oEs,idx){!!$(oEs[idx]).attr("lazy-src")&&$(oEs[idx]).Y_LoadImg({imgSrc:$(oEs[idx]).attr("lazy-src"),delay:delay,callback:function(){loadImg(oEs,idx+1);}});}; }; w.add($('.oScroll,.hScroll,.vScroll')).scroll(function(){ $.fn.Y_LazyLoad.Init($b); });return this} ,Y_Move: function(opt) { var def={transparent:!0,slidable:!1,flipIn:!1,flipOut:!1, fullpageScroll:!1,mScroll:!1,anchors:[],setHash:!1,hashRoot:"Y_MoveSection", InOut:!0,steps:200,oddEven:!0,AniPagination:!1,AniItem:!1,synchro:!0,stopable:!0, IsLoop:!0,loopDir:!0,IsDrag:!1,dragHand:!1,instant:!1,clickPass:!0,IsPaging:!1,setPaging:!1,sNumPaging:!1,sptPaging:!1,backInit:!1, contain:".ysqJsBox,.ysqMoveBox,.box",item:".item",Pagination:".pagination",prev:".prev",next:".next", clickMoveTg:[!1,"h","scroll"], lazyLoad:[!0,20],lockTime:500, delaytion:[0,0],direction:"h",easing:"easeOutQuad",event:"click",duration:800,TimeOut:0,initNum:0,MinNum:1, fn:{before:null,after:null,start:null,callback:null,icoClick:null,ctrReject:null}};opt=$.extend({},def,opt); // before ($this,$TtC) after ($this,$TtC,$Tg) // start,callback :function($this,$TtC,idx,pdx,ndx,dir,icoClick)) this.each(function(ix, oE) { var $this=$(oE),$Tt=$(opt.contain,oE).eq(0),$ctr=$(opt.prev+','+opt.next,oE),$TtC=$Tt.find(opt.item),TtL=$TtC.length,TtW,$Tg,$TgC, pdx=0,ndx=0,idxed=0,bHor=opt.direction=="h", Num=Math.ceil(TtL/opt.MinNum)-1,bSlideBox=opt.slideBox||opt.MinNum>1; oE.idx=opt.initNum/1; opt.slidable==!1&&(opt.slidable=opt.flipIn||opt.flipOut); oE.dragIn = !1;oE.Dragable=opt.IsDrag; opt.fn.before&&opt.fn.before.call(this,$this,$TtC); var mCancelEvent=(opt.mScroll&&opt.fullpageScroll&&ysq.IsMoble); if(opt.sNumPaging) {tensDigit = function(i){return i;};} if(mCancelEvent) {$this.addClass('mScroll')} if(UCTest()){opt.TimeOut=!1;} if(TtL<=opt.MinNum){ $this.addClass("_nojs _loaded"); opt.lazyLoad[0]&&fnLazyloadPd($this)&&$.fn.Y_LazyLoad.Init($this,!0,opt.lazyLoad[1]); opt.fn.start&&opt.fn.start.call(this,$this,$TtC,oE.idx,pdx,ndx,0,!1); SetActive(!0); setCss(); return true;} if(!bSlideBox){$TtC.css({position:"absolute"}).each(function(i,e){$(e).css("z-index",9-i); });} if(opt.setPaging){ for(var hPagination=""+tensDigit(1)+"",i=1;i<=Num;i++){ hPagination+=(opt.sptPaging?"":"")+(""+""+tensDigit(i+1)+"")}; if($(opt.Pagination,oE).length){$(opt.Pagination,oE).append(hPagination);}else{ $this.append("
"+hPagination+"
");} } if(opt.IsPaging){ $Tg=$(opt.Pagination,oE); $TgC=$Tg.find('.btn'),TgL=$TgC.length; opt.AniPagination&&$TgC.Y_SetCss3({easing:"linear",dur:opt.TimeOut+"s"}); } function setCss(){ if(bSlideBox){ var _size={width:parseInt($TtC.outerWidth()),height:parseInt($TtC.outerHeight())}; // TtW=bHor?getW(opt.MinNum==1?$this:$TtC):getH(opt.MinNum==1?$this:$TtC); TtW=getWH(/*opt.MinNum==1?$this:*/$TtC,!bHor); bHor?$Tt.css({width:(2+TtW)*Math.max(TtL,opt.MinNum)}):$Tt.css({height:(2+TtW)*Math.max(TtL,opt.MinNum)}); if(ysq.IsMoble&&$TtC.css("box-sizing")=="border-box"){ bHor ? $TtC.css({width:_size.width,marginRight:mlr($TtC,0)}) : $TtC.css({height:_size.height,marginTop:mtb($TtC,1)}); } }else if(opt.fullpageScroll){ $h.css({zoom:"1"}); mCancelEvent||setVamCss(w.height()/(parseFloat($h.css("zoom")||1))-$('.header').outerHeight(),"fullpage-section",".vm"); } else { // if(opt.evenWidth){var _w1=$this.outerWidth(); $('.shade',$this).css({left:"50%",marginLeft:-1*(_w1+(_w1%2!=0?1:0))/2});} } } function _start(){ $this.addClass('_moveing'); } function _end(){ $this.removeClass('_moveing'); } function HashCheck(){ var value = window.location.hash.replace('#'+opt.hashRoot+'=', '').split('/'); if(opt.anchors.length){for(var i=0;i0){ clearInterval(oE.Y_timer);oE.Y_timer=setInterval(function(){oE.next(!0);},opt.TimeOut*1e3);}}; oE.dirPD=function(beta){beta>0?$this.addClass("dir_z").removeClass("dir_f"):$this.addClass("dir_f").removeClass("dir_z");}; oE.resetDistance=function(dir){oE.Move(dir,!1,null,!0)}; oE.mouseWheelFn=function(){ $(document).one("mousewheel.Y_Move",function(mouseEvents){ !ysq.IsMoble&&oE.ysqble&&(mouseEvents.deltaY<0?oE.next():oE.prev()); }); }; oE.prev=function(bTgEvents,dur){var _pdx=oE.idx,_dir; oE.idx=(--oE.idx)<0 ?(((!opt.IsLoop||(oE.Dragable&&oE.dragIn&&opt.MinNum>1))/*||(!bTgEvents&&oE.Dragable&&bSlideBox)*/)?0:Num):oE.idx; _dir=opt.loopDir?-1:(_pdx>oE.idx)?-1:1; if(oE.idx==_pdx){ opt.fullpageScroll&&oE.mouseWheelFn(); bTgEvents&&$(opt.prev,oE).Y_Animation({animation:"dotShake"}); if(opt.instant) {oE.resetDistance(_dir)} opt.fn.ctrReject&&opt.fn.ctrReject.call(this,$this,$TtC,_dir)} else if($TtC.eq(oE.idx).hasClass("_stay")||oE.prevDisable){oE.idx=_pdx;} else{oE.Move(_dir,!1,dur);} }; oE.next=function(bTgEvents,dur){var _pdx=oE.idx,_dir; oE.idx=(++oE.idx)>Num?(((!opt.IsLoop||(oE.Dragable&&oE.dragIn&&opt.MinNum>1))/*||(!bTgEvents&&oE.Dragable&&bSlideBox)*/)?Num:0):oE.idx; _dir=opt.loopDir?1:(_pdx>oE.idx)?-1:1; if(oE.idx==_pdx){ opt.fullpageScroll&&oE.mouseWheelFn(); bTgEvents&&$(opt.next,oE).Y_Animation({animation:"dotShake"}); if(opt.instant) {oE.resetDistance(_dir)} opt.fn.ctrReject&&opt.fn.ctrReject.call(this,$this,$TtC,_dir)} else if($TtC.eq(oE.idx).hasClass("_stay")||oE.nextDisable){oE.idx=_pdx;} else{oE.Move(_dir,!1,dur);} }; oE.MoveTo=function(_idx){ if(_idx==oE.idx){return !0;} var dir=_idx>oE.idx?1:_idx1)){ if(oE.idx*opt.MinNum==0){ $(opt.prev,oE).addClass("nagetive"); }else{ $(opt.prev,oE).removeClass("nagetive"); } if(oE.idx*opt.MinNum>=TtL-opt.MinNum){ $(opt.next,oE).addClass("nagetive"); }else{ $(opt.next,oE).removeClass("nagetive"); } } setProperty(oE,"ysqble",!1); oE.AutoNext(); oE.dirPD(dir); var iPrev=oE.idx+1>(TtL-1)?0:oE.idx+1,iNext=oE.idx-1<0?(TtL-1):oE.idx-1; dur=dur==null?opt.duration:dur; if(dir>=0){pdx=icoClick?oE.idxed:iNext;ndx=iPrev}else if(dir<0){pdx=icoClick?oE.idxed:iPrev;ndx=iNext} // c("--------------------------\n"+oE.className+"\nidx:"+oE.idx+";pdx:"+pdx+";ndx:"+ndx+"\n--------------------------"); if(opt.MinNum==1&&opt.oddEven){$TtC.eq(oE.idx).hasClass('odd')?$TtC.eq(ndx).addClass("even").removeClass("odd"):$TtC.eq(ndx).addClass("odd").removeClass("even"), $TtC.eq(oE.idx).hasClass('even')?$TtC.eq(ndx).addClass("odd").removeClass("even"):$TtC.eq(ndx).addClass("even").removeClass("odd");} noCBK||opt.fn.start&&opt.fn.start.call(this,$this,$TtC,oE.idx,pdx,ndx,dir,icoClick); /*$this.data('index',oE.idx);*/ opt.setHash&&(location.hash = opt.hashRoot+"=" + (opt.anchors.length?opt.anchors[oE.idx]:oE.idx)); opt.lazyLoad[0]&&fnLazyloadPd($TtC.slice(0,(oE.idx+1)*opt.MinNum))&&$.fn.Y_LazyLoad.Init($TtC.slice(0,(oE.idx+1)*opt.MinNum),!0,opt.lazyLoad[1]); setTextLine($("[data-text-line]",$this)); if(icoClick){opt.fn.icoClick&&opt.fn.icoClick.call(this,$this,$TtC,oE.idx,pdx,ndx,dir,icoClick);} if(bSlideBox){ opt.instant&&opt.IsPaging&&onoff($TgC.eq(oE.idx)); opt.synchro&&SetActive(); var distance=-Math.ceil((oE.idx>=Num?(Math.max(TtL,opt.MinNum)-opt.MinNum)*TtW:oE.idx*TtW*opt.MinNum)), // percent=(Math.abs(parseInt($Tt.css(bHor?'left':'top'))-distance)/TtW)%1, _goal=bHor?{"left":distance}:{"top":distance}; var percent = Math.min(1,Math.abs(parseInt(distance) - parseInt($Tt.css(bHor?'left':'top')))/TtW/opt.MinNum); if(opt.InOut){var _dur=$this.hasClass("dir_z")?0:opt.MinNum*opt.steps; var Now=oE.idx>=Num?(TtL-1):oE.idx var tL=(Now+1)*opt.MinNum,bL=tL-opt.MinNum; $TtC.each(function(i,_oE) { if((i+1>bL)&&(i+1<=tL)){ if($this.hasClass("dir_z")){if($(_oE).hasClass("in")){_dur+=0}else{_dur+=opt.steps;} }else{if($(_oE).hasClass("in")){_dur-=0}else{_dur-=opt.steps;} } setTimeout(function(){$(_oE).addClass('in'); },dir==0?0:_dur); }else{setTimeout(function(){$(_oE).removeClass("in"); },dir==0?0:(percent?(1-percent):1)*dur); } }); } if(dir==0){SetStatus(dir,icoClick,noCBK);$Tt.css(_goal);}else{_start(); $Tt.stop(!0,!1).animate(_goal,(percent?percent:1)*dur,opt.easing,function(){ SetStatus(dir,icoClick,noCBK);_end();}); }; }else{ //opt.lazyLoad[0]&&fnLazyloadPd($TtC.eq(oE.idx))&&$.fn.Y_LazyLoad.Init($TtC.eq(oE.idx),!0,opt.lazyLoad[1]); setProperty(oE,"ysqble",!opt.InOut&&(opt.clickPass)/*opt.clickPass&&!opt.InOut&&(opt.flipOut||opt.flipIn)*/) ; var _iop=opt.transparent?0:1,_pop=opt.transparent?0:1,dis=opt.slidable?dir*100:0;$TtC.eq(ndx).css("z-index",7)/*.show();*/ if(bHor){var Iset={"left":dis+"%","opacity":_iop },Pset={"left":0,"opacity":1 }, Igoal={left:0,opacity:1},Pgoal={"left":-1*dis+"%","opacity":_pop}; }else{var Iset={"top":dis+"%","opacity":_iop },Pset={"top":0,"opacity":1 }, Igoal={top:0,opacity:1},Pgoal={"top":-1*dis+"%","opacity":_pop};} $TtC.css({"z-index":1}).css(Iset).eq(oE.idx).css("z-index",9).css(Igoal); opt.lazyLoad[0]&&$TtC.hide().eq(oE.idx).stop(!0,!0).show(); setTimeout(function(){opt.synchro&&SetActive(); },10); if(opt.AniItem&&ysq.Switch){ //淇濆瓨scrollEle var $oT=$TtC.eq(oE.idx); $('[scrollEle-temp]',$oT).add($oT).each(function(i,oE) { $(oE).attr("scrollEle-temp")&&$(oE).attr("scrollEle",$(oE).attr("scrollEle-temp")); }); $('[scrollEle]',$oT).add($oT).addClass('AniDo').trigger("destroy.Y_ScrollEle"); } if(dir==0){SetStatus(dir,icoClick,noCBK);opt.oddEven&&$TtC.eq(0).addClass("odd"); }else{ if(opt.InOut){ //$TtC.eq(pdx).addClass("leave"); $TtC.eq(oE.idx).addClass("come"); onoff($TtC.eq(pdx),{cls:"leave"}),onoff($TtC.eq(oE.idx),{cls:"come"}); opt.IsPaging&&(onoff($TgC.eq(pdx),{cls:"Out"}),onoff($TgC.eq(oE.idx),{cls:"In"})/*$TgC.eq(pdx).addClass("Out"),$TgC.eq(oE.idx).addClass("In")*/); setTimeout(function(){ setTimeout(function(){ opt.IsPaging&&$TgC.eq(pdx).removeClass("Out"); $TtC.eq(pdx).removeClass("leave"); },opt.delaytion[0]); setTimeout(function(){ opt.IsPaging&&$TgC.eq(oE.idx).removeClass("In"); $TtC.eq(oE.idx).removeClass("come"); },opt.delaytion[1]); },(dur)) }; // pdx $TtC.eq(pdx).show().stop(!0,opt.clickPass).css(Pset).css("z-index",16); // setTimeout(function(){ $TtC.eq(pdx).animate(opt.flipIn?Pset:Pgoal,(dur),opt.easing,function(){opt.slidable&&opt.backInit&&$(this).css(Pset); opt.lazyLoad[0]&&$(this).stop(!0,!0).hide();}); },opt.delaytion[0]); // idx $TtC.eq(oE.idx).show().stop(!0,opt.clickPass).css(opt.flipOut?Igoal:Iset).css("z-index",(!opt.slidable||opt.flipIn)?22:12); // setTimeout(function(){ $TtC.eq(oE.idx).animate(Igoal,(dur),opt.easing,function(){SetStatus(dir,icoClick,noCBK); }) },opt.delaytion[1]); } } }; /*init_after*/ bindScrollFn(oE,function(){ clearInterval(oE.Y_timer); inWindow($this,null,!0) && oE.AutoNext(); }); $this.addClass("_loaded"); $TtC.addClass("moveItem").eq(0).addClass('on'); opt.lazyLoad[0]&&$TtC.addClass('waitLoad'); opt.flipOut&&$TtC.Y_SetCss3({ppty:"transform",dur:opt.duration+"ms"}); if(opt.setHash){HashCheck();} setTimeout(function(){ oE.Move(0,!1,0,!1); oE.dirPD(1); //oE.AutoNext(); opt.fn.after&&opt.fn.after.call(this,$this,$TtC,$TgC); },1); (w.resize(function(){setCss();bSlideBox&&oE.Move(0);}),setCss()); (opt.stopable||$this.data("stopable"))&&(ysq.IsMoble||opt.TimeOut)&&($this.on({"mousemove.Y_Move":function(){clearInterval(oE.Y_timer);}, "mouseleave.Y_Move":function(){oE.AutoNext();}})); opt.setHash&&w.on('hashchange',function(event){var _pdx=oE.idx; HashCheck();if(_pdx!=oE.idx){ location.hash=opt.hashRoot+"="+(opt.anchors.length?opt.anchors[oE.idx]:oE.idx);oE.Move(opt.duration,!1,0);}}); (oE.Dragable||ysq.IsMoble)&&!mCancelEvent&&$this.Y_Drag({cursorHand:opt.fullpageScroll?!1:opt.dragHand,contain:opt.contain,direction:$this[0].direction||opt.direction, left:oE.next,right:oE.prev,up:oE.next,down:oE.prev,instant:bSlideBox&&opt.instant,dragPass:opt.transparent}); if(opt.fullpageScroll){ // mousewheel oE.mouseWheelFn(); // keycode $(document).on('keydown.Y_Move',function(event){ if (!oE.ysqble){return !0;} // var keycode=event.which||event.keyCode; /// prevent_default(event) switch (event.which||event.keyCode) { case 37: bHor&&oE.prev();break; //LEFT case 39: bHor&&oE.next();break; //RIGHT case 38: bHor||oE.prev();break; //UP case 40: bHor||oE.next();break; //DOWN case 33: oE.prev(); break; //pUp case 34: oE.next(); break; //pDOWN case 36: oE.MoveTo(0); break; //HOME case 35: oE.MoveTo(TtL-1); break; //END // default: return; } }); } if($ctr.length){ $ctr.show(); var $prev=$(opt.prev,oE),$next=$(opt.next,oE); $next.click(function(){oE.ysqble||$(this).hasClass('unable')?oE.next(!0):$(this).Y_Animation({animation:"dotShake"});}); $prev.click(function(){oE.ysqble||$(this).hasClass('unable')?oE.prev(!0):$(this).Y_Animation({animation:"dotShake"});}); ysq.IsMoble?$ctr.addClass('ctrShow') :$this.on({"mousemove.Y_Move":function(event){ var X=event.pageX,Y=event.pageY, bPD=bHor?X<$this.outerWidth()/2+$this.offset().left:Y<$this.outerHeight()/2+$this.offset().top; bPD?onoff($prev,{cls:"ctrShow",sib:".ctr"}):onoff($next,{cls:"ctrShow",sib:".ctr"});} ,"mouseleave.Y_Move":function(event){$ctr.removeClass('ctrShow');} }) } opt.IsPaging&&$TgC.on(opt.event,function(){ if(opt.clickPass||opt.event=="mouseenter"){setProperty(oE,"ysqble",!0); } if($(this).hasClass('on')||!oE.ysqble){return $(this).Y_Animation({animation:"dotShake"});} opt.stopable||opt.TimeOut&&oE.AutoNext(); oE.MoveTo($TgC.index($(this)));}) }); return this;} ,Y_Drag: function(opt) { var def={contain:".ysqJsBox,.ysqMoveBox,.box",direction:"h",instant:!1,dragPass:!1,reMove:!1,fullScreen:!1,easing:"jswing",cursorHand:!0,followDiv:!1,left:null,right:null,up:null,down:null};opt=$.extend({},def,opt); var pos={x1:0,x2:0,y1:0,y2:0},dir=opt.direction; var $this=this,oE=$this[0],$Tt=$(opt.contain,$this).eq(0),basePos,bMoving=!1,bMoved=!1,bDid=!1,bScroll=!1,runTime;setProperty(oE,"ysqble",!0); opt.cursorHand&&!opt.followDiv&&$this.addClass('willdrag'); var mdown=function(event){ opt.dragPass&&(oE.ysqble=!0); if(!oE.ysqble||!oE.Dragable){return !0;}//runTime=new Date().getTime(); $this.addClass('holding'); // if($(event.target).is("a")){return prevent_default(event)} var touchEve=Touchable?event.touches[0]:event; pos.x1=pos.x2=touchEve.pageX; pos.y1=pos.y2=touchEve.pageY; basePos={left:parseInt($Tt.css("left")),top:parseInt($Tt.css("top"))}; if(Touchable){addEvent($Tt[0],TouchIng,function(e){mdo(e);},!1);addEvent($Tt[0],TouchEd,function(e){mup();},!1);} else{$Tt.on(TouchIng,function(e){mdo(e);}).on(TouchEd,function(e){mup();});$this.addClass("MouseDown");$Tt.trigger('mouseenter'); prevent_default(event);}; bMoving=!0; bScroll=!1; }, mdo=function(event){ if(!bMoving){return !0;} bDid=!0; var touchEve=Touchable?event.touches[0]:event; pos.x2=touchEve.pageX; pos.y2=touchEve.pageY; // c('y1:'+pos.y1+',y2:'+pos.y2+',x1:'+pos.x1+',x2:'+pos.x2); var chaX=pos.x2-pos.x1,chaY=pos.y2-pos.y1; if(chaX>0||chaY>0){Touchable||$this.addClass("MouseMove");} if(opt.instant){ var _In=pos.y2<$this.offset().top+$this.outerHeight()&&pos.y2>$this.offset().top; switch (dir) { case "h":if(_In){$Tt.css({"left":basePos.left+pos.x2-pos.x1});bMoved=!0; }else{bMoved&&$Tt.stop(!0,!1).animate({"left":basePos.left},opt.easing,Math.abs(pos.x2-pos.x1),_Reset);bMoved=!1;};break; case "v":if(_In){$Tt.css({"top" :basePos.top+pos.y2-pos.y1});bMoved=!0; }else{bMoved&&$Tt.stop(!0,!1).animate({"top" :basePos.top},opt.easing,Math.abs(pos.y2-pos.y1),_Reset);bMoved=!1;};break; case "o":if(_In){$Tt.css({"left":basePos.left+pos.x2-pos.x1,"top":basePos.top+pos.y2-pos.y1});bMoved=!0; }else{bMoved&&$Tt.stop(!0,!1).animate({"left":basePos.left,"top":basePos.top},opt.easing,Math.abs(pos.x2-pos.x1),_Reset);bMoved=!1;};break; } // switch (dir) { case "h": if(Math.abs(chaX)>Math.abs(chaY)){prevent_default(event);bScroll=!1;}else{bScroll=!0;}break; case "v": if(Math.abs(chaX)Math.abs(chaY)){prevent_default(event);}else{bScroll=!0;} // c('y1:'+pos.y1+',y2:'+pos.y2+',x1:'+pos.x1+',x2:'+pos.x2); }else{bMoved=!0;}; clearInterval($Tt[0].Y_timer); function _Reset(){setProperty(oE,"ysqble",!0);pos.x2=pos.x1;pos.y2=pos.y1;} }, mup=function(event){ bMoving=!1; setTimeout(function(){ $this.removeClass("MouseMove").removeClass("MouseDown").removeClass('holding'); },100); if(!bDid){return !0;} bDid=!1; // if($(event.target).is("a")){return prevent_default(event)} var nToW=$this.outerWidth(), nToH=$this.outerHeight(), nAbsX=Math.abs(pos.x2-pos.x1), nAbsY=Math.abs(pos.y2-pos.y1); $this[0].dragIn = !0; if(!bMoved||bScroll){ //娌″姩 if(dir=="h"){$Tt.stop(!0,!1).animate({"left":basePos.left},nAbsX,opt.easing,function(){setProperty(oE,"ysqble",!0);});} if(dir=="v"){$Tt.stop(!0,!1).animate({"top":basePos.top},nAbsY,opt.easing,function(){setProperty(oE,"ysqble",!0);});} // return bMoving=!1,!0; }else{ switch (dir) { case "h":if(nAbsX>Math.min(nToW/40,w.width()/40)){ sl();sr(); }else{$Tt.stop(!0,!1).animate({"left":basePos.left},nAbsX,opt.easing,function(){setProperty(oE,"ysqble",!0);});} break; case "v":if(nAbsY>Math.min(nToH/40,w.height()/40)){ su();sd(); }else{$Tt.stop(!0,!1).animate({"top" :basePos.top},nAbsY,opt.easing,function(){setProperty(oE,"ysqble",!0);});} break; case "o":if(nAbsX>Math.min(nToW/40,w.width()/40)){sl();sr();} if(nAbsY>Math.min(nToH/40,w.height()/40)){su();sd();}setProperty(oE,"ysqble",!0);break;}; } if(Touchable){ $Tt[0].removeEventListener(TouchIng,mdo,!1); $Tt[0].removeEventListener(TouchEd,mup,!1); }else{$Tt.off(TouchIng, mdo).off(TouchEd, mup);} /*$Tt.trigger('mouseleave'); */ bMoved=!1 ; prevent_default(event); },reMoveEvent = function() {(opt.reMove||$this.data("removeDrag"))&&(Touchable?$Tt[0].removeEventListener(TouchOn,mdown,!1):$this.off(TouchOn, mdown)); },mlv = function(event) { $Tt.trigger(TouchEd); },/*dirPD = function(beta) {beta>0?$this.addClass("dir_z").removeClass("dir_f"):$this.addClass("dir_f").removeClass("dir_z"); },*/sl=function(){if($.isFunction(opt.left)&&(pos.x2<=pos.x1)){ /*dirPD(1);*/opt.left(!1);reMoveEvent(); } },sr=function(){if($.isFunction(opt.right)&&(pos.x2>pos.x1)){ /*dirPD(-1);*/opt.right(!1);reMoveEvent(); } },su=function(){if($.isFunction(opt.up)&&(pos.y2<=pos.y1)){ /*dirPD(1);*/opt.up(!1);reMoveEvent(); } },sd=function(){if($.isFunction(opt.down)&&(pos.y2>pos.y1)){ /*dirPD(-1);*/opt.down(!1);reMoveEvent(); } };Touchable?addEvent($Tt[0],TouchOn,mdown,!1):$Tt.on(TouchOn,mdown).on("mouseleave", mlv); return this; } ,Y_SetCss3: function(opt){ // .Y_SetCss3({ppty:"all",delay:0,dur:300}) var def={ppty:"all",delay:"0ms",easing:"ease",dur:"300ms"};opt=$.extend({},def,opt); this.css({"transition-property":opt.ppty,"transition-timing-function":opt.easing,"transition-duration":opt.dur,"transition-delay":opt.delay}); return this;} ,Y_Animation: function(opt) { var def = {animation: "", Inout: !0, delaytion: 0, callback: function() {} }; opt = $.extend({}, def, opt); var cls = 'AniDo AniDoing ' + opt.animation, vs = (opt.Inout ? "vv" : "vh"); this.each(function(i, oE) { var $this=$(oE); setTimeout(function() { $this.addClass(cls + " " + vs); setTimeout(function() { $this.removeClass(cls); $this.data('flag') || $this.removeClass(vs); opt.callback.call(this, $this); }, getAniDur($this)); }, opt.delaytion); }); return this; } ,Y_ModalAlbum: function(opt) { var def={triggerList:"",item:".item",btn:"",contain:".contain",list:".list0",albumItem:"albumItem",albumName:null, Pagination:".pagination",IsPaging:!0,PagingSept:!0,paginationEve:"click",IsDrag:!0,instant:!0,bLoop:!1,synchro:!0,zoomer:!1, easing:"easeInQuad",duration:500,pad:[0,0,0,0],posSet:[56,56,26,56], fn:{created:null,start:null,callback:null}};opt=$.extend({},def,opt); var $this=this,oE=$this[0], sPic=opt.triggerList+" "+opt.item+" "+opt.btn, $contain=$(opt.contain,oE),$list=$(opt.list,oE), $Total=$(".totalNum",oE),$Present=$(".presentNum",oE),$picName=$(".picName",oE),$originalBtn=$(".originalBtn",oE), idx=0,TtL=0,TtW=0,bSwitch=!1; oE.Dragable=opt.IsDrag; if(!$this.length){return ;} $this.appendTo($b); oE.destroy = function () { bSwitch = !1; $this.removeClass("visible vvva"); $originalBtn.attr("href"," "); setTimeout(function(){opt.IsPaging&&$(opt.Pagination,oE).remove(); $list.empty();},1); unlockScroll(); $(document).off("keydown.Y_ModalAlbum"); // $('.zoomBox',$this).smartZoom('destroy') ; }; oE.prev = function () { idx=--idx<0?!opt.bLoop?0:TtL-1:idx; oE.Move(); }; oE.next = function () { idx=++idx>TtL-1?!opt.bLoop?TtL-1:0:idx; oE.Move(); }; oE.Move = function () { if(!opt.bLoop){ if(idx==0){ $this.find(".prev").hide(); }else{ $this.find(".prev").show(); } if(idx==TtL-1){ $this.find(".next").hide(); }else{ $this.find(".next").show(); } } var distance = -idx * TtW , $item = $list.children("."+opt.albumItem).eq(idx), percent=Math.min((Math.abs(parseInt($list.css('left'))-distance)/TtW),1); opt.fn.start && opt.fn.start.call(this, $this, idx); opt.synchro&&(opt.IsPaging&&onoff($Tg.eq(idx)),onoff($item)); setProperty(oE,"ysqble",!1); fnLazyloadPd($item)&&$.fn.Y_LazyLoad.Init($item,!0); $list.stop(!0, !1).animate({left: distance }, opt.duration*percent, percent==1?opt.easing:'jswing', function() { setProperty(oE,"ysqble",!0); opt.synchro||(opt.IsPaging&&onoff($Tg.eq(idx)),onoff($item)); opt.fn.callback && opt.fn.callback.call(this, $this, idx); opt.zoomer&&setTimeout(function(){ $item.find('.picBox').smartZoom({ containerClass:'zoomableContainer', dblClickEnabled: !1, adjustOnResize:!0, maxScale:1 // , mouseMoveEnabled: !1, // moveCursorEnabled: !1, // mouseEnabled:!1 }); },501); }); $Present.html(idx + 1); $picName.text($("img",$item).attr("alt")); $originalBtn.attr("href",$("img",$item).attr("src")); }; //bind Event $('.contain',$this)[0].Dragable=opt.IsDrag; opt.IsDrag&&$('.contain',$this).Y_Drag({direction:"h",left:function(){oE.next(!0);},right:function(){oE.prev(!0);},instant:!0}); // opt.IsDrag&&$this.Y_Drag({direction:"v",top:function(){oE.destroy();},bottom:function(){oE.destroy();}}); w.off("resize.Y_ModalAlbum").on("resize.Y_ModalAlbum",function(){if(!bSwitch) return; var $items=$("."+opt.albumItem, $list); setVamCss(w.height()-opt.posSet[0]-opt.posSet[2]-opt.pad[0]-opt.pad[2] , opt.albumItem , ".img"); $items.css({width:$contain.width(),marginRight:mlr($items,0)}); TtW = getWH($items,!1); $list.css({"width": TtL * (2+TtW), "left": -idx * (TtW) }); }); // click $b.delegate(sPic, 'click', function(event) { if($(this).parents('.MouseMove').length) return !0; bSwitch = !0; // oE.setVm(); var $_btn=$(this), $_list=$_btn.parents(opt.triggerList), $items=$(opt.item,$_list); if($_btn.is(opt.item)){ var $_itemP=$_btn, $_btnP=$_itemP, $pics=$items, _rate=1 }else { var $_itemP=$_btn.parents(opt.item), $_btnP=$(opt.btn,$_itemP), $pics=$(opt.btn,$_list), _rate=$_btnP.length } // $_itemP=$_btn.hasClass(opt.btn.replace(".",""))?$_btn:$_btn.parents(opt.item); //濡傛灉click鐨勫氨鏄痠mg 鐩存帴鍙 img鐨刬ndex ; //濡傛灉click鐨勫氨鏄痠mg 鐩存帴鍙 img鐨刬ndex idx = ($items.index($_itemP))*_rate+($_btnP.index($_btn)); TtL = $pics.length; // c(_rate) // 鏋勫缓鐩稿唽 // 娣诲姞鐩哥墖 $pics.each(function(i, oPic) { var src=$("img", oPic).attr("big-src")||$("img", oPic).attr("lazy-src")||$("img", oPic).attr("src"), sName=$("h3",oPic).text()||$("img",oPic).attr("alt"); $("
  • ").appendTo($list); if(opt.zoomer){ $("",{"src":src,"alt":sName}).appendTo($("."+opt.albumItem, $list).eq(i)) .wrap("
    ") ; }else{ $("",{"src":src,"alt":sName}).appendTo($("."+opt.albumItem, $list).eq(i)) // .wrap(function(a1,a2,a3){return ""}) .wrap("
    ") .wrap("") ; } opt.fn.created && opt.fn.created.call(this, $this, $("."+opt.albumItem, $list).eq(i), $(oPic)); }); // 娣诲姞椤电爜 if(opt.IsPaging){ for(var Pagination="01",i=1;i<=(TtL-1);i++){Pagination+=(opt.PagingSept?"":"")+(""+""+tensDigit(i+1)+"")}; if($(opt.Pagination,oE).length){$(opt.Pagination,oE).append(Pagination);}else{$contain.append("");} $Tg=$(opt.Pagination,oE).find('.btn'),TgL=$Tg.length,TgW=getW($Tg); opt.AniPagination&&$Tg.Y_SetCss3({dur:opt.TimeOut+"s"}); } // 鐩哥墖搴忓彿 $Total.html(TtL);$Present.html(idx + 1); // 缁戝畾浜嬩欢 $this.addClass("visible vvva va"); // $this.css({width:w.width(),height:w.height()}) setTimeout(function(){ // setVamCss($contain.height()-opt.pad[Y_ModalAlbum0]-opt.pad[1],opt.albumItem,".img"); // TtW = $contain.width(); // $list.css({"width": TtL * TtW, "left": -idx * TtW }).find('.'+opt.albumItem).width(TtW); w.trigger('resize.Y_ModalAlbum'); oE.Move(idx); // $('.zoomBox',$this).smartZoom({ // containerClass:'zoomableContainer', // dblClickEnabled: !1, // adjustOnResize:!0, // maxScale:2 // // , mouseMoveEnabled: !1, // // moveCursorEnabled: !1, // // mouseEnabled:!1 // }); $this.find(".close").off("click.Y_ModalAlbum").on("click.Y_ModalAlbum",function(){oE.destroy(); }); $this.find(".prev").off("click.Y_ModalAlbum").on("click.Y_ModalAlbum",function(){oE.prev();}); $this.find(".next").off("click.Y_ModalAlbum").on("click.Y_ModalAlbum",function(){oE.next();}); opt.IsPaging&&$Tg.off(opt.paginationEve+".Y_ModalAlbum").on(opt.paginationEve+".Y_ModalAlbum",function(){ if($(this).hasClass('on')){return $(this).Y_Animation({animation:"dotShake"});} idx=$Tg.index($(this)); oE.Move(); }); $(document).on("keydown.Y_ModalAlbum", function(event) { switch(event.keyCode){case 27: oE.destroy(); break; case 37: oE.prev(); break; case 39: oE.next(); break; default: break; } }); },1);lockScroll(); });return this;} ,Y_OffsetMove : function(opt){ // // XXXXXX // ;(function($){ // // $('.XXXXXX').Y_OffsetMove({item:".link",single:!1,prev:null,next:".next",vertical:!1}); // })(jQuery); var def={viewport:".viewport",overview:".overview",item:".item",single:!0,prev:null,next:null,vertical:!1};opt=$.extend({},def,opt); this.each(function(i,oE) { // ($this,$TtC,idx) var $this=$(oE),$viewport=$(opt.viewport,oE),$overview=$(opt.overview,oE),$items=$(opt.item,$viewport),bV=opt.vertical, $prev=$(opt.prev,oE),$next=$(opt.next,oE), nPw=0, nPol=0, nNum=$items.length,nDis=0; oE.idx=0;oE.bOnce=!0; function getViewPort(){ nPw=Math.ceil(bV?$viewport.outerHeight():$viewport.outerWidth()); nPol=Math.ceil(bV?$viewport.offset().top:$viewport.offset().left); }; oE.Move = function (dir,clickIn) { var nTtDis=bV?$viewport.scrollTop():$viewport.scrollLeft(); if(opt.single||clickIn){ var $oE=$items.eq(oE.idx), nEw=Math.ceil(bV?$oE.outerHeight():$oE.outerWidth()), nEol=Math.ceil(bV?$oE.offset().top:$oE.offset().left); if(!(nEol>nPol&&(nEol+nEw)nPw){nDis=nEw+nDis-nPw;} } }else { if(Math.round($items.eq(-1).outerWidth()+$items.eq(-1).offset().left)<=Math.round(nPw+nPol)){ nDis=0; }else{ $items.each(function(ix,ex) { var nIw=Math.ceil(bV?$(ex).outerHeight():$(ex).outerWidth()), nIol=Math.ceil(bV?$(ex).offset().top:$(ex).offset().left); if(nIw+nIol>nPw+nPol&&oE.bOnce){ if(nDis==nIol+nTtDis-nPol&&nIw>nPw){ nDis+=nPw; }else{ nDis=nIol+nTtDis-nPol; } oE.bOnce=!1; } }); } } $viewport.stop(!1,!0).animate(bV?{"scrollTop":nDis}:{"scrollLeft":nDis},dir==0?0:Math.min(600,Math.abs(nDis-nTtDis)),function(){oE.bOnce=!0;}); }; // init Offset var $itemOn=$(opt.item,$this).filter(function(){return $(this).hasClass("on");}); nDis = $itemOn.length ? ($itemOn.offset().left+ $viewport.scrollLeft()- ($viewport.offset().left)+$itemOn.outerWidth()/2-$viewport.outerWidth()/2) : 0; $viewport.animate(bV?{"scrollTop":nDis}:{"scrollLeft":nDis},0); // $items.each(function(i,e) {if(oE.idx==0 && ($(e).outerWidth()+$(e).offset().left>$oP.offset().left+$oP.outerWidth())){oE.idx=i; } }); w.off('resize.Y_OffsetMove').on("resize.Y_OffsetMove",function(event) { if($this.is(':hidden')){return; } getViewPort(); if($overview.outerWidth()>$viewport.outerWidth()){$('.ctr',$this).removeClass('reject') } else {$('.ctr',$this).addClass('reject');} }).trigger('resize.Y_OffsetMove'); $prev.off("click.Y_OffsetMove").on("click.Y_OffsetMove",function(event){ oE.idx=(--oE.idx<0)?nNum-1:oE.idx; setTimeout(function(){ oE.Move(-1)},1);}); $next.off("click.Y_OffsetMove").on("click.Y_OffsetMove",function(event){ oE.idx=(++oE.idx)%nNum; setTimeout(function(){ oE.Move(1)},1);}); // $items.off("click.Y_OffsetMove").on("click.Y_OffsetMove",function(event) { var idx=$items.index($(this)); // if(oE.idx!=idx){var dir=oE.idx>idx?1:-1; oE.idx=idx; oE.Move(dir,!0); } }); $viewport.scroll(function(event) { nDis=bV?$viewport.scrollTop():$viewport.scrollLeft(); $items.each(function(ix,ex) { var nIw=Math.ceil(bV?$(ex).outerHeight():$(ex).outerWidth()), nIol=Math.ceil(bV?$(ex).offset().top:$(ex).offset().left); if(nIw+nIol<=nPw+nPol&&nIol>=nPol){oE.idx=$items.index($(ex));} }); }); });return this; } ,Y_RotateMove: function(opt) { var def = {bCss3:[!1,3],duration:800,TimeOut:0,stopable:!0,cssArray:[],IsPaging:!1,PagingSept:!1,initNum:0,IsDrag:!1,followDiv:!1,clickMove:!1, Pagination:".pagination",contain:".ysqJsBox,.ysqMoveBox,.box",item:".item",prev:".prev",next:".next", item_actClass:"on",pagination_actClass:"on",fn:{before:null,start:null,callback:null,after:null} }; opt = $.extend({}, def, opt); // callback:function($this,idx){} // cssArray:[ // {padding:0,width:311,height:498,top:40,left:524,opacity:0.5}, // base lb:50%-w/2 // {padding:0,width:311,height:498,top:40,left:0,opacity:1}, // -2 l1 // {padding:0,width:335,height:536,top:22,left:200,opacity:1}, // -1 l2 // {padding:0,width:360,height:576,top:0,left:500,opacity:1}, // 0 l0:50%-w/2 // {padding:0,width:335,height:536,top:22,left:825,opacity:1}, // +1 lf1:100%-l2-w // {padding:0,width:311,height:498,top:40,left:1049,opacity:1} // +2 lf2:100%-w // ] // .aaaaaaaaaaa { // @w:750;@h:315;@p:0;@mar:30; // @L0w:250;@L0h:315; // @L1w:210;@L1h:260; // @L2w:0;@L2h:0; // .base {padding:@p; width:0;height:0;top:@h/2;left:@w/2; opacity:0} // .p2on {padding:@p; width:@L2w;height:@L2h;top:(@h - @L2h)/2;left:@mar; opacity:1} // .p1on {padding:@p; width:@L1w;height:@L1h;top:(@h - @L1h)/2;left:@mar; opacity:1} // .on {padding:@p; width:@L0w;height:@L0h;top:0;left:(@w - @L0w)/2; opacity:1} // .n1on {padding:@p; width:@L1w;height:@L1h;top:(@h - @L1h)/2;left:@w - @mar - @L1w; opacity:1} // .n2on {padding:@p; width:@L2w;height:@L2h;top:(@h - @L2h)/2;left:@w - @mar - @L2w; opacity:1} // } this.each(function(i, oE) { var $this=$(oE),$Tt=$(opt.contain,oE),$TtC=$Tt.find(opt.item),$ctr=$(opt.prev+','+opt.next,oE),TtL=$TtC.length,$Tg,$TgC,TgL,TgW; var _TtL=TtL,baseCss=opt.cssArray[0];var baseHTML=$Tt.html(); oE.Dragable=opt.IsDrag;oE.idx=opt.initNum/1; oE._cssArray=opt.cssArray.slice(1); $TtC.each(function(i,e) {$(e).attr("data-index",i);}); opt.fn.before && opt.fn.before.call(this,$this); // opt.bCss3&&oE._cssArray=[0,0,0,0,0]; if (TtL==0) return; if (TtL0?(idx+1>=TtL?0:idx+1):(idx-1<0?TtL-1:idx-1); } oE.Move=function (idx,dur,dir,noCbk,notTrans){ noCbk||oE.start(); oE.AutoNext(); var mid=Math.round(oE._cssArray.length/2)-1,zArray=dir>0?[10,22,25,18,15]:[15,18,25,22,10]; notTrans||opt.IsPaging&&_TtL!=1&&onoff($TgC.eq(idx%_TtL),{cls:opt.pagination_actClass}); $TtC.addClass("base").css("z-index",0).removeClass(opt.item_actClass+' L0 L1 L2 on pOn nOn'); $TtC.eq(oE.idx).removeClass("base").addClass(opt.item_actClass+" L0").css("z-index",zArray[2]); $TtC.eq(getIndex(oE.idx,-1)).removeClass("base").addClass("L1 pOn").css("z-index",zArray[1]); $TtC.eq(getIndex(oE.idx,1)).removeClass("base").addClass("L1 nOn").css("z-index",zArray[3]); if(oE._cssArray.length>3||opt.bCss3[1]==5){ $TtC.eq(getIndex(getIndex(oE.idx,-1),-1)).removeClass("base").addClass("L2 pOn").css("z-index",zArray[0]); $TtC.eq(getIndex(getIndex(oE.idx,1),1)).removeClass("base").addClass("L2 nOn").css("z-index",zArray[4]); } if(!opt.bCss3[0]){ $TtC.animate(baseCss,dur,"swing"); $TtC.eq(oE.idx).stop(!0,!1).animate(oE._cssArray[mid],dur,"swing",function(){noCbk||oE.callback();}) .siblings(opt.item); $TtC.eq(getIndex(oE.idx,-1)).stop(!0,!1).animate(oE._cssArray[mid-1],dur,"swing"); $TtC.eq(getIndex(oE.idx,1)).stop(!0,!1).animate(oE._cssArray[mid+1],dur,"swing"); // c(oE._cssArray) // if(oE._cssArray.length>3){ // $TtC.eq(getIndex(getIndex(oE.idx,-1),-1)).stop(!0,!1).animate(oE._cssArray[mid-2],dur,"swing"); // $TtC.eq(getIndex(getIndex(oE.idx,1),1)).stop(!0,!1).animate(oE._cssArray[mid+2],dur,"swing"); // } }else{ setTimeout(function(){noCbk||oE.callback(); },opt.duration); } }; oE.start = function () { setProperty(oE,"ysqble",opt.clickMove); opt.fn.start&&opt.fn.start.call(this,$this,oE.idx%_TtL);fnLazyloadPd($this)&&$.fn.Y_LazyLoad.Init($this,!1); }; oE.callback = function () { setProperty(oE,"ysqble",!0); opt.fn.callback && opt.fn.callback.call(this,$this,oE.idx%_TtL); }; oE.prev = function () { oE.idx = oE.idx-1<0?TtL-1:oE.idx-1; oE.Move(oE.idx,opt.duration,-1); }; oE.next = function () { oE.idx = oE.idx+1>TtL-1?0:oE.idx+1; oE.Move(oE.idx,opt.duration,1); }; oE.AutoNext = function () { if(opt.TimeOut>0){clearInterval(oE.timer);oE.timer=setInterval(function(){oE.next();},opt.TimeOut*1e3);} }; // init if(opt.IsPaging&&_TtL!=1){ for(var Pagination="01",i=1;i<=_TtL-1;i++){Pagination+=(opt.PagingSept?"":"")+(""+""+tensDigit(i+1)+"")}; if($(opt.Pagination,oE).length){$(opt.Pagination,oE).append(Pagination);}else{$this.append("");} $Tg=$(opt.Pagination,oE),$TgC=$Tg.find('.btn'),TgL=$Tg.length,TgW=getW($Tg); opt.AniPagination&&$Tg.Y_SetCss3({dur:opt.TimeOut+"s"}); // $(opt.Pagination,oE).hasClass('autoW')&&$(opt.Pagination,oE).css({"width":TgL*TgW,left:"50%","margin-left":-TgL*TgW/2}); } $this.addClass('_loaded'); $TtC.addClass('moveItem'); setTimeout(function(){ setProperty(oE,"ysqble",!0); oE.Move(oE.idx,0,1); // fnLazyloadPd($this)&&$.fn.Y_LazyLoad.Init($this,!0); $(opt.next+","+opt.prev, oE).show(); opt.fn.after && opt.fn.after.call(this,$this); },1); // bindEvents // c(oE.Dragable) oE.Dragable&&$this.Y_Drag({direction:"h",left:oE.next,right:oE.prev,instant:!1,followDiv:opt.followDiv}); if($ctr.length){ var $prev=$(opt.prev,oE),$next=$(opt.next,oE); $next.click(function(){oE.ysqble=!0;oE.ysqble||$(this).hasClass('unable')?oE.next(!0):$(this).Y_Animation({animation:"dotShake"});}); $prev.click(function(){oE.ysqble=!0;oE.ysqble||$(this).hasClass('unable')?oE.prev(!0):$(this).Y_Animation({animation:"dotShake"});}); ysq.IsMoble?$ctr.addClass('ctrShow') :$this.on({"mousemove.Y_RotateMove":function(event){ var X=event.pageX,Y=event.pageY, bPD=X<$this.outerWidth()/2+$this.offset().left; bPD?onoff($prev,{cls:"ctrShow",sib:".ctr"}):onoff($next,{cls:"ctrShow",sib:".ctr"});} ,"mouseleave.Y_RotateMove":function(event){$ctr.removeClass('ctrShow');} }) } opt.clickMove&&$Tt.delegate('.moveItem','click.Y_RotateMove',function(event){ if(oE.ysqble){ var _idx=$(this).index(); clearTimeout(oE.sequence); if(getIndex(oE.idx,1)==_idx){ oE.idx=_idx; oE.Move(oE.idx,opt.duration,1); }else if(getIndex(oE.idx,-1)==_idx){ oE.idx=_idx; oE.Move(oE.idx,opt.duration,-1); }else if(getIndex(getIndex(oE.idx,-1),-1)==_idx){ oE.idx=getIndex(_idx,+1); oE.Move(oE.idx,opt.duration/2,-1,!0,!0); oE.sequence==setTimeout(function(){ oE.idx=_idx; oE.Move(oE.idx,opt.duration/2,-1); },opt.duration/3); }else if(getIndex(getIndex(oE.idx,1),1)==_idx){ oE.idx=getIndex(_idx,-1); oE.Move(oE.idx,opt.duration/2,1,!0,!0); oE.sequence==setTimeout(function(){ oE.idx=_idx; oE.Move(oE.idx,opt.duration/2,1); },opt.duration/3); }else{ var _dir=oE.idx-_idx; oE.idx=_idx; oE.Move(oE.idx,opt.duration,_dir); } } }); opt.IsPaging&&$TgC.on("click.Y_RotateMove").on("click.Y_RotateMove",function(){ var idx = $(this).index(); $(".moveItem",$Tt).eq(idx).trigger('click.Y_RotateMove'); }); opt.TimeOut && $this.off("mouseenter.Y_RotateMove").off("mouseleave.Y_RotateMove").on("mouseenter.Y_RotateMove",function(){ opt.stopable&&clearInterval(oE.timer);}).on("mouseleave.Y_RotateMove", function(){oE.AutoNext(); }).trigger("mouseleave.Y_RotateMove"); }); return this;} ,Y_Modal: function(opt) { var def={sTrigger:null,autoSetCss:!1,bLockScroll:!0,bKeyboard:!0,duration:300,fn:{callback:null,fnNo:null,fnYes:null}};opt=$.extend({},def,opt); // function($this,$trigger){ if(!$(this).length){return !0;} var bActive,$this=this,sTrigger=opt.sTrigger;$this[0].sTrigger=""; $this.appendTo($b); $('.zhezhao',$this).length||$this.prepend(makeMask()); sTrigger?$b.delegate(sTrigger,TouchEd,function(g){fnShowUp();$this[0].trigger=this;}):fnShowUp(); opt.bKeyboard&&$(document).keydown(function(o){bActive&&27==o.keyCode&&$this[0].fnCloseDown(function(){opt.fn.fnNo && opt.fn.fnNo.call(this, $this, $($this[0].trigger)) });}); $this[0].fnCloseDown = function(_FnCallback){ $this.addClass("hideOut"); setTimeout(function(){ $this.fadeOut(opt.duration, function() { bActive = !1; opt.bLockScroll && unlockScroll($this); _FnCallback&&_FnCallback(); $this.removeClass("showUp").removeClass("hideOut"); $this[0].trigger = null; }); },400); }; function fnShowUp() { bActive=!0;opt.autoSetCss&&setCss(); opt.bLockScroll && lockScroll($this); $this.fadeIn(opt.duration,function(){ opt.fn.callback && opt.fn.callback.call(this, $this, $($this[0].trigger)); fnLazyloadPd($this)&&$.fn.Y_LazyLoad.Init($this,!1); // 寤舵椂缁戝畾 setTimeout(function(){ $this.find(".close").off(TouchEd+".Y_Modal").on(TouchEd+".Y_Modal", function(event) { var $btn=$(this); $this[0].fnCloseDown(function(){opt.fn.fnNo && opt.fn.fnNo.call(this, $this, $($this[0].trigger), $btn) }); return prevent_default(event); }); $this.find(".ok").off(TouchEd+".Y_Modal").on(TouchEd+".Y_Modal", function() { var $btn=$(this); $this[0].fnCloseDown(function(){opt.fn.fnYes && opt.fn.fnYes.call(this, $this, $($this[0].trigger), $btn) }); }); },250); }).addClass("showUp"); }; $(document).off("keydown.Y_Modal").on("keydown.Y_Modal", function(event) { if(event.keyCode==27){$this[0].fnCloseDown(function(){opt.fn.fnNo && opt.fn.fnNo.call(this, $this, $($this[0].trigger)) });}; }); if (opt.autoSetCss){w.resize(function(){setCss();});function setCss(){if(bActive){var_th=$this.outerHeight(),_wh=w.height(),_h1=$b.height()-_th,_h2=(_th<0.9*_wh)?((_wh-_th)*0.5+w.scrollTop()):(_wh*0.05+w.scrollTop());$this.css({top:_h1<=_h2?_h1:_h2});}};} return this; } ,Y_Tab: function(opt) { var def={Tt:".Tt",Tg:".Tg",TBtn:".btn",contain:">.ysqJsBox,>.ysqMoveBox,>.box",item:null,link:".Ta",TgActCls:"on",TtActCls:"on" ,prev:null,next:null,btnAnimate:!1,animateTt:!1,lazyLoad:[!0,100],AniPagination:!1 ,event:"click",init:!0,initNum:0,TimeOut:0,duration:1,stopable:!0,mouseWheelMove:!1 ,PagingSept:!1,hasNum:!1,keyboard:!1,overviewMid:!1,IsDrag:!1,clickMoveTg:[!1,"h","scroll"],IsLoop:!1 ,fn:{before:null,after:null,start:null,callback:null}};opt=$.extend({},def,opt); // prev:".prev",next:".next" // clickMoveTg:[!0,"h","scroll"], // callback:function($this,idx,$TtC,$TgC,$Ta) // w.on('resize.linkable', function(event) { // setProperty($this[0],"linkable",$h.hasClass("wap")); // $h.hasClass("wap")||bOnce==!1&&(bOnce=!0,$TgC.eq(0).trigger('click.Y_Tab')); // $h.hasClass("wap")&&bOnce!=!0&&(bOnce=!1); // }).trigger('resize.linkable'); this.each(function(i,oE){ var $this=$(oE),$Tt=$(opt.Tt,oE),$Tg=$(opt.Tg,oE),$Ta=$(opt.link,oE),$TtC=$Tt.find(opt.contain),TtL=$TtC.length,$TgC=$Tg.find(opt.TBtn),TgL=$TgC.length, $next=$(opt.next,oE),$prev=$(opt.prev,oE),bIn=!1;setProperty(oE,"ysqble",!0);oE.idx=opt.initNum/1;oE.pdx=0; oE.Dragable=opt.IsDrag; opt.fn.before&&opt.fn.before.call(this,$this,$TtC,$TgC,$Ta); if($TtC.length==1){ $this.addClass("_nojs _loaded"); opt.lazyLoad[0]&&fnLazyloadPd($this)&&$.fn.Y_LazyLoad.Init($this,!0,opt.lazyLoad[1]); opt.fn.start&&opt.fn.start.call(this,$this,oE.idx,$TtC,$TgC,$Ta); return true; } // Fn oE.Move=function(bInit,noCBK){ var _idx=oE.idx; if(opt.IsLoop){ _idx=_idx%($TgC.length/2); } var $oG=$TgC.eq(oE.idx), $oT=$TtC.eq(_idx); oE.idx>oE.pdx?$this.addClass("dir_z").removeClass("dir_f"):$this.addClass("dir_f").removeClass("dir_z"); onoff($TtC.eq(oE.pdx),{cls:"leave"}),onoff($TtC.eq(oE.idx),{cls:"come"});oE.AutoNext(); // reset $TtC.removeClass(opt.TtActCls); $Tg.length&&onoff($oG,{cls:opt.TgActCls}); $Ta.length&&$Ta.attr("href",$oG.attr("data-href")||$oG.attr("href")); setTextLine($("[data-text-line]",$oG)); noCBK||(opt.fn.start&&opt.fn.start.call(this,$this,oE.idx,$TtC,$TgC,$Ta)); if(opt.animateTt){ //淇濆瓨scrollEle $('[scrollEle-temp]',$oT).add($oT).each(function(i,oE) { $(oE).attr("scrollEle-temp")&&$(oE).attr("scrollEle",$(oE).attr("scrollEle-temp")); }); $('[scrollEle]',$oT).removeClass('AniStart').removeClass('AniDid').addClass('AniDo').trigger("destroy.Y_ScrollEle"); } opt.clickMoveTg[0]?setTimeout(function(){ clickMoveTg(opt.clickMoveTg[1]); if(opt.IsLoop){ $TgC.eq(_idx).addClass(opt.TgActCls); setTimeout(function(){ oE.idx=_idx; clickMoveTg(opt.clickMoveTg[1],0); },opt.duration+1); } },1):(opt.btnAnimate&&oE.barMove()); function afterDraw(){ // c(bInit) bInit||opt.lazyLoad[0]&&fnLazyloadPd($oT)&&$.fn.Y_LazyLoad.Init($oT,!0,opt.lazyLoad[1]); bInit||fnScrollElePd($oT)&&($.fn.Y_ScrollEle.Init($oT),$.fn.Y_ScrollEle.Do($oT,0,!0)); } // active !$oT.length?setProperty(oE,"ysqble",!0):($oT.addClass(opt.TtActCls),setTextLine($("[data-text-line]",$this)),afterDraw(), setTimeout(function(){ opt.mouseWheelMove&&oE.mouseWheelFn(); setProperty(oE,"ysqble",!0); opt.overviewMid&&ysq.MsBoxSet($oT.find('.overview')); noCBK||(opt.fn.callback&&opt.fn.callback.call(this,$this,oE.idx,$TtC,$TgC,$Ta)); $oT.removeClass("waitLoad"); $TtC.eq(oE.pdx).removeClass("leave"); $TtC.eq(oE.idx).removeClass("come"); },(bInit?0:opt.duration)+1)); }; oE.barMove = function(){ var $block = $('.block',oE),goal={}; var $ii = $TgC.eq(oE.idx), oIos=$ii.offset(),oTos=$Tg.offset(); if(opt.clickMoveTg[1] == "h"){ goal=opt.blockSize?{left:oIos.left-oTos.left+($ii.outerWidth()-$block.width())/2,top:0,height:"100%",opacity:1} :{left:oIos.left - oTos.left,width:$ii.outerWidth(),top:0,height:"100%",opacity:1}; }else{goal=opt.blockSize?{top:oIos.top-oTos.top+($ii.outerHeight()-$block.height())/2,left:0,width:"100%",opacity:1} :{top:oIos.top-oTos.top,height:$ii.outerHeight(),left:0,width:"100%",opacity:1}; } $h.hasClass("pc")?$block.stop(!0,!1).animate(goal,opt.duration):$block.show().css(goal); }; oE.mouseWheelFn=function(){ $this.one("mousewheel.Y_Move",function(mouseEvents){ if(!bIn){bIn=!0;} else{!ysq.IsMoble&&oE.ysqble&&(mouseEvents.deltaY<0?oE.next():oE.prev()); } }); }; oE.next=function(){oE.pdx=oE.idx;oE.idx=++oE.idx%TgL;setProperty(oE,"ysqble",!1);oE.Move();}; oE.prev=function(){oE.pdx=oE.idx;oE.idx=--oE.idx<0?(TgL-1):oE.idx;setProperty(oE,"ysqble",!1);oE.Move();}; oE.AutoNext=function(){if(opt.TimeOut>0){ clearInterval(oE.Y_timer);oE.Y_timer=setInterval(function(){oE.next(!0);},opt.TimeOut*1e3);}}; function clickMoveTg(dir,dur){ var $viewport=$Tg.find('.viewport').length?$Tg.find('.viewport'):$Tg, $overview=$(".overview",$Tg), $itemOn=$('.btn.on',$this); if($itemOn.length){ var X = opt.clickMoveTg[3]==undefined?0.5:opt.clickMoveTg[3]; var _dis={ x:$itemOn.offset().left+$viewport.scrollLeft()-($viewport.offset().left)+($itemOn.outerWidth()-$viewport.outerWidth())*X ,y:$itemOn.offset().top+$viewport.scrollTop()-($viewport.offset().top)+($itemOn.outerHeight()-$viewport.outerHeight())*X }; var _css=(opt.clickMoveTg[2]!="scroll")?{left:-1*_dis.x,top:-1*_dis.y}:{scrollLeft:_dis.x,scrollTop:_dis.y}; var _dur=(opt.clickMoveTg[2]!="scroll")?dur==undefined?400:dur:dur==undefined?400:dur; $viewport.stop(!0,!1).animate(_css, _dur,function(){ // opt.lazyLoad[0]&&fnLazyloadPd($viewport)&&$.fn.Y_LazyLoad.Init($viewport,!0,opt.lazyLoad[1]); opt.btnAnimate&&oE.barMove(); }); } }; if(opt.IsLoop){ $TgC.last().after($TgC.clone()); $TgC=$Tg.find(opt.TBtn); } if(opt.mouseWheelMove){oE.mouseWheelFn(); } // init if(!$TgC.length){for(var sTgC="",i=0;i":"")+""+(opt.hasNum?(i+1):" ")+""}; $Tg.append(sTgC);$TgC=$Tg.find(opt.TBtn);TgL=$TgC.length;} opt.AniPagination&&$TgC.Y_SetCss3({easing:"linear",dur:opt.TimeOut+"s"}); bindScrollFn(oE,function(){ clearInterval(oE.Y_timer); inWindow($this,null,!0) && oE.AutoNext(); }); oE.Move(!0); fnLazyloadPd($b)&&$.fn.Y_LazyLoad.Init($b,!1); opt.lazyLoad[0]&&$TtC.addClass('waitLoad'); opt.fn.after&&opt.fn.after.call(this,$this,$TtC,$TgC,$Ta); // opt.animateTt&&$("[scrollEle]",$this).attr("scrollStay",1); // opt.init&&!oE.linkable&&oE.Move(!0); // bindEvents $TgC.off(opt.event+".Y_Tab").on(opt.event+".Y_Tab",function(event){ if(oE.ysqble&&!oE.linkable){ if(!$(this).hasClass(opt.TgActCls)){ var _idx = $TgC.index($(this)); var _len = /*opt.IsLoop?$TgC.length/2:*/$TgC.length oE.pdx=oE.idx, oE.idx= _idx%_len; if(opt.item){ if($TtC.eq(oE.idx).find(opt.item).length) {oE.Move()} }else{oE.Move()} } return prevent_default(event); } }); (opt.stopable||$this.data("stopable"))&&(ysq.IsMoble||opt.TimeOut)&&($this.on({"mousemove.Y_Move":function(){bIn=!0; clearInterval(oE.Y_timer);}, "mouseleave.Y_Move":function(){bIn=!1; oE.AutoNext();}})); // prev&next if($TtC.length>1){ $next.length&&$next.show().click(function(event){oE.ysqble?oE.next():$(this).Y_Animation({animation:"dotShake"});}); $prev.length&&$prev.show().click(function(event){oE.ysqble?oE.prev():$(this).Y_Animation({animation:"dotShake"});}); } // oE.Dragable&&$this.Y_Drag({contain:opt.Tt,direction:opt.clickMoveTg[1],left:oE.next,right:oE.prev,down:oE.prev,up:oE.next}); opt.btnAnimate&&w/*.off('resize.Y_Tab')*/.on('resize.Y_Tab', function(event) { opt.btnAnimate&&oE.barMove(); }); // keyboard opt.keyboard&&$(document).keydown(function(event){if(bIn){event.keyCode==39&&($next.length?$next.trigger('click'):oE.next());event.keyCode==37&&($prev.length?$prev.trigger('click'):oE.prev());}}); }); return this;} }); //plugins.js /* linear swing jswing easeInQuad easeOutQuad easeInOutQuad easeInCubic easeOutCubic easeInOutCubic easeInQuart easeOutQuart easeInOutQuart easeInQuint easeOutQuint easeInOutQuint easeInSine easeOutSine easeInOutSine easeInExpo easeOutExpo easeInOutExpo easeInCirc easeInOutCirc easeInElastic easeOutElastic easeInOutElastic easeInBack easeInOutBack easeInBounce easeOutBounce easeInOutBounce */ jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(A,B,C,D,E){return jQuery.easing[jQuery.easing.def](A,B,C,D,E);},easeInQuad:function(A,B,C,D,E){return D*(B/=E)*B+C},easeOutQuad:function(A,B,C,D,E){return-D*(B/=E)*(B-2)+C},easeInOutQuad:function(A,B,C,D,E){if((B/=E/2)<1){return D/2*B*B+C}return-D/2*((--B)*(B-2)-1)+C},easeInCubic:function(A,B,C,D,E){return D*(B/=E)*B*B+C},easeOutCubic:function(A,B,C,D,E){return D*((B=B/E-1)*B*B+1)+C},easeInOutCubic:function(A,B,C,D,E){if((B/=E/2)<1){return D/2*B*B*B+C}return D/2*((B-=2)*B*B+2)+C},easeInQuart:function(A,B,C,D,E){return D*(B/=E)*B*B*B+C},easeOutQuart:function(A,B,C,D,E){return-D*((B=B/E-1)*B*B*B-1)+C},easeInOutQuart:function(A,B,C,D,E){if((B/=E/2)<1){return D/2*B*B*B*B+C}return-D/2*((B-=2)*B*B*B-2)+C},easeInQuint:function(A,B,C,D,E){return D*(B/=E)*B*B*B*B+C},easeOutQuint:function(A,B,C,D,E){return D*((B=B/E-1)*B*B*B*B+1)+C},easeInOutQuint:function(A,B,C,D,E){if((B/=E/2)<1){return D/2*B*B*B*B*B+C}return D/2*((B-=2)*B*B*B*B+2)+C},easeInSine:function(A,B,C,D,E){return-D*Math.cos(B/E*(Math.PI/2))+D+C},easeOutSine:function(A,B,C,D,E){return D*Math.sin(B/E*(Math.PI/2))+C},easeInOutSine:function(A,B,C,D,E){return-D/2*(Math.cos(Math.PI*B/E)-1)+C},easeInExpo:function(A,B,C,D,E){return(B==0)?C:D*Math.pow(2,10*(B/E-1))+C},easeOutExpo:function(A,B,C,D,E){return(B==E)?C+D:D*(-Math.pow(2,-10*B/E)+1)+C},easeInOutExpo:function(A,B,C,D,E){if(B==0){return C}if(B==E){return C+D}if((B/=E/2)<1){return D/2*Math.pow(2,10*(B-1))+C}return D/2*(-Math.pow(2,-10*--B)+2)+C},easeInCirc:function(A,B,C,D,E){return-D*(Math.sqrt(1-(B/=E)*B)-1)+C},easeOutCirc:function(A,B,C,D,E){return D*Math.sqrt(1-(B=B/E-1)*B)+C},easeInOutCirc:function(A,B,C,D,E){if((B/=E/2)<1){return-D/2*(Math.sqrt(1-B*B)-1)+C}return D/2*(Math.sqrt(1-(B-=2)*B)+1)+C},easeInElastic:function(A,B,C,D,E){var F=1.70158;var G=0;var H=D;if(B==0){return C}if((B/=E)==1){return C+D}if(!G){G=E*0.3}if(H1?m.options.decimal+t[1]:"",i=/(\d+)(\d{3})/,m.options.useGrouping)for(;i.test(n);)n=n.replace(i,"$1"+m.options.separator+"$2");return m.options.prefix+n+e+m.options.suffix},prefix:"",suffix:""},r&&"object"==typeof r)for(var d in m.options)r.hasOwnProperty(d)&&null!==r[d]&&(m.options[d]=r[d]);""===m.options.separator&&(m.options.useGrouping=!1),m.initialize=function(){return!(!m.initialized&&(m.d="string"==typeof a?document.getElementById(a):a,m.d?(m.startVal=Number(t)||0,m.endVal=Number(n)||0,o(m.startVal)&&o(m.endVal)?(m.decimals=Math.max(0,e||0),m.dec=Math.pow(10,m.decimals),m.duration=1e3*Number(i)||2e3,m.countDown=m.startVal>m.endVal,m.frameVal=m.startVal,m.initialized=!0,0):(console.error("[CountUp] startVal or endVal is not a number",m.startVal,m.endVal),1)):(console.error("[CountUp] target is null or undefined",m.d),1)))},m.printValue=function(a){var t=m.options.formattingFn(a);"INPUT"===m.d.tagName?this.d.value=t:"text"===m.d.tagName||"tspan"===m.d.tagName?this.d.textContent=t:this.d.innerHTML=t},m.count=function(a){m.startTime||(m.startTime=a),m.timestamp=a;var t=a-m.startTime;m.remaining=m.duration-t,m.options.useEasing?m.countDown?m.frameVal=m.startVal-m.options.easingFn(t,0,m.startVal-m.endVal,m.duration,m.options.rate):m.frameVal=m.options.easingFn(t,m.startVal,m.endVal-m.startVal,m.duration,m.options.rate):m.countDown?m.frameVal=m.startVal-(m.startVal-m.endVal)*(t/m.duration):m.frameVal=m.startVal+(m.endVal-m.startVal)*(t/m.duration),m.countDown?m.frameVal=m.frameValm.endVal?m.endVal:m.frameVal,m.frameVal=Math.round(m.frameVal*m.dec)/m.dec,m.printValue(m.frameVal),tm.endVal,m.rAF=requestAnimationFrame(m.count))}},m.initialize()&&m.printValue(m.startVal)}; /*pluginsE*/ /* basic Fn S*/ function a(n){alert(n)} function c(n){console.log(n)} function cw(n){console.warn(n)} function ce(n){console.error(n)} function dbn(n,t){t=t||"",n.show().siblings(t).hide()} function mlr(n,t){return Math.ceil(parseInt(n.css(t?"margin-left":"margin-right")))||0} function mtb(n,t){return Math.ceil(parseInt(n.css(t?"margin-top":"margin-bottom")))||0} function plr(n,t){return Math.ceil(parseInt(n.css(t?"padding-left":"padding-right")))||0} function ptb(n,t){return Math.ceil(parseInt(n.css(t?"padding-top":"padding-bottom")))||0} function getW(t){return Math.ceil(parseInt(t.outerWidth()+mlr(t,1)+mlr(t,0)))} function getH(t){return Math.ceil(parseInt(t.outerHeight()+mtb(t,1)+mtb(t,0)))} function getWH(t,e){return Math.ceil(e?parseInt(t.outerHeight()+mtb(t,1)+mtb(t,0)):parseInt(t.outerWidth()+mlr(t,1)+mlr(t,0)))} function getAniDur(a){return parseFloat(a.css("animation-duration"))>10?parseFloat(a.css("animation-duration")):1e3*parseFloat(a.css("animation-duration"))} function sElements(t){return String(t[0].tagName+"."+t.attr("class"))} function fnScrollElePd(l){return ysq.Switch&&$.fn.Y_ScrollEle&&(l.is("[scrollEle]")||l.find("[scrollEle]").length)} function fnLazyloadPd(l){return $.fn.Y_LazyLoad&&l.find("[lazy-src]").length&&l.find("[lazy-src]").length} function bindScrollFn(oE,fn){$(oE).addClass("Y_AutoCheck");oE.fnAuto=function(){fn();}} function inWindow($e,nErr,borderIn){ if(!$e.length) return; var eoT=$e.offset().top,eoL=$e.offset().left, wSt=w.scrollTop(),wSl=w.scrollLeft(),wBl=wSt+w.height(),nErr=nErr||[0,0]; if(ysq.IsMoble){nErr=[0,w.height()/10]} // 瑙嗙獥杈圭晫 var vLl=wSl+0,vRl=wSl+w.width()-0,vTl=wSt+nErr[0],vBl=wBl-nErr[1]; // 鍏冪礌杈圭晫 var eLl=eoL,eRl=eoL+$e.outerWidth(),eTl=eoT,eBl=eoT+$e.outerHeight(); // hEle>hView var bHin=eRl-eLl>=vRl-vLl ? (eRl>=vLl&&vLl>=eLl)||(eRl>=vRl&&eLl<=vRl) : (eRl>=vLl&&eRl<=vRl)||(eLl>=vLl&&eLl<=vRl); // vEle>vView var bVin=eBl-eTl>=vBl-vTl ? (eBl>=vTl&&vTl>=eTl)||(eBl>=vBl&&eTl<=vBl) : (eBl>=vTl&&(eBl<=vBl||(wBl>=$b.outerHeight()-nErr[1]&&eTl<=wBl)))||(eTl<=vBl&&(eTl>=vTl||((wSt<=nErr[0]||$e.css("position")=="fixed")&&eTl>=wSt))); // 杈圭晫杩涘叆 if(borderIn){ bHin = (eRl>=vLl&&eRl<=vRl)||(eLl<=vRl&&eLl>=vLl); bVin = (eBl>=vTl&&eBl<=vBl)||(eTl<=vBl&&eTl>=vTl); } // if(!0&&$e.is('#########')){$("#testShade").remove();$("
    ",{class:"ts",css:{left:vLl,top:vTl,width:vRl-vLl,height:vBl-vTl,"position":"absolute","zIndex":"9999","pointer-events":"none","background-color":"rgba(0,0,0,.5)"},id:"testShade"}).appendTo($b);} ysq.Test&&ysq.TT&&cw("outerWindow:"+sElements($e)); return (bHin&&bVin); } function inTheView(pos,$viewport){ var ePos={L:($viewport.offset().left)/1 ,R:($viewport.offset().left+$viewport.outerWidth())/1 ,T:($viewport.offset().top)/1 ,B:($viewport.offset().top+$viewport.outerHeight())/1 } // $("#testShade").remove(); $("
    ",{class:"ts",css:{left:ePos.L,top:ePos.T,width:ePos.R-ePos.L,height:ePos.B-ePos.T,"position":"absolute","zIndex":"9999","pointer-events":"none","background-color":"rgba(0,0,0,.5)"},id:"testShade"}).appendTo($b); return pos.left>=ePos.L&&pos.left<=ePos.R&&pos.top>=ePos.T&&pos.top<=ePos.B; } function SE_GetAniName(e){if((e=e||"").indexOf(",")>=0&&e.split(",").length>1)return e.split(",");switch(e){case"rotateS":return["rotateInUpRight","rotateInDownLeft"];case"rotateN":return["rotateInDownRight","rotateInUpLeft"];case"lightLR":return["lightSpeedInLeft","lightSpeedInRight"];case"slideLR":return["slideInLeft","slideInRight"];case"fadeLR":return["fadeInLeft","fadeInRight"];case"fadeLRs":return["fadeInLefts","fadeInRights"];case"fadeLRm":return["fadeInLeftm","fadeInRightm"];case"fadeUD":return["fadeInUp","fadeInDown"];case"fadeUDs":return["fadeInUps","fadeInDowns"];case"fadeUDm":return["fadeInUpm","fadeInDownm"];case"fade4s":return["fadeInUps","fadeInLefts","fadeInRights","fadeInDowns"];case"fade4":return["fadeInUp","fadeInLeft","fadeInRight","fadeInDown"];case"fade4m":return["fadeInUpm","fadeInLeftm","fadeInRightm","fadeInDownm"];case"zoomLR":return["zoomInLeft","zoomInRight"];case"zoomUD":return["zoomInUp","zoomInDown"];case"bounceLR":return["bounceInLeft","bounceInRight"];case"bounceUD":return["bounceInUp","bounceInDown"];default:return[e]}} function isHidden($e){return $e.is(':hidden')||$e.parent().css("visibility")=="hidden";} function fnPen($e,dur) {if(!$e.hasClass("_pen")){ $e.addClass("_pen");setTimeout(function(){$e.removeClass("_pen"); },dur||800);} } function iPhoneTest(){return navigator.userAgent.indexOf("iPhone")>-1} function MacTest(){return /macintosh|mac os x/i.test(navigator.userAgent)} function UCTest(){return navigator.userAgent.indexOf("UCBrowser")>-1/*&&navigator.userAgent.indexOf("Safari")>-1*/} function SaveData(name,value,time){time=time||1; var o=new Date();o.setDate(o.getDate()+time),document.cookie=name+"="+value+";expires="+o;} function GetData(name){for(var n=document.cookie.split("; "),t=0;t0?str.slice(str.indexOf(".")+1):[];} function MinWidth(e){return w.width()>e?!0:!1;} function isNull(e){return ((""==!!e)||undefined==!!e||null==!!e||(/^[ ]+$/.test(e)));} function isSpace(e){return ((e=="\r")||(e=="\n")||(e==" "));} function stopEvent(e){e = $.event.fix(e); e.preventDefault();} function stopprop(e){if(!(e=e||window.event)||!e.stopPropagation)return window.event.cancelBubble=!1,!1;e.stopPropagation()} function prevent_default(e){if(!(e=e||window.event)||!e.preventDefault)return window.event.returnValue=!1,!1;e.preventDefault()} function addEvent(t,n,e,a){if(t.addEventListener)return t.addEventListener(n,e,a),!0;if(t.attachEvent){var r=t.attachEvent("on"+n,e);return r}t["on"+n]=e} function removeEvent(e,n,t,r){if(e.removeEventListener)return e.removeEventListener(n,t,r),!0;if(e.detachEvent){var v=e.detachEvent("on"+n,t);return v}return void(e["on"+n]=null)} function setVamCss(s,e,t,bTxt){$(".css"+e).length&&$(".css"+e).remove();var sClass="."+e+" "+(t||""); $("head").append('')} function setProperty(oE,ppty,_boole){_boole?$(oE).removeClass("_disabled"):$(oE).addClass("_disabled"),$(oE).attr("temp_ID",0),eval('$("[temp_ID]")[0].'+ppty+"="+_boole),$(oE).removeAttr("temp_ID");} function lockScroll($e){if($e&&$e.length){addEvent($e[0],ysq.IsMoble?TouchIng:wheelEvent,function(e){stopEvent(e);},!1);} else {if(ysq.IsMoble){w.lastPosTop=w.scrollTop();setTimeout(function(){$h.add($b).css({height:"100%",overflow:"hidden"});$('.scroll-wrap').css({top:-1*w.lastPosTop}); },1);}else{var st=w.scrollTop(); w.on("scroll.lock",function(event) {w.scrollTop(st);});$b.css({overflow:"hidden"});}} } function unlockScroll($e){if($e&&$e.length){removeEvent($e[0],ysq.IsMoble?TouchIng:wheelEvent,function(e){stopEvent(e);},!1);} else {if(ysq.IsMoble){$h.add($b).css({height:"auto",overflow:"visible"});w.scrollTop(w.lastPosTop);$('.scroll-wrap').css({top:"auto"});}else{w.off("scroll.lock");$b.css({overflow:"auto"});}} } function packStr(t,c,h){h=h||"i",t.each(function(t,a){for(var r=$(a).html(),n="",e=0;e"+r.charAt(e)+"":r.charAt(e);$(a).html(n)})} function makeMask(a){var c={zIndex:0,color:"#000",opacity:.6,id:" ",cls:"close"};return"
    "} function onoff(s,l){var n={cls:"on",sib:""};l=$.extend({},n,l),s.addClass(l.cls).siblings(l.sib).removeClass(l.cls)} function inout(l,n){var s={cls:"on",sib:"",dur:0,cbk:null};n=$.extend({},s,n),l.addClass(n.cls).stop(!0,!0).fadeIn(n.dur,function(){n.cbk&&n.cbk(),fnScrollElePd(l)&&($.fn.Y_ScrollEle.Init(l),$.fn.Y_ScrollEle.Do(l,0,!0))}).siblings(n.sib).removeClass(n.cls).fadeOut(n.dur)} function setTextLine($oE,line,nw){ $oE.each(function(i,oE) { if(oE.lined||$(oE).is(":hidden")){return !0;} var i = $(oE), arr=i.attr("data-text-line")&&i.attr("data-text-line").split(","), e = line||arr[0], r = i.css("font-size"), n = i.width() * e, a = $.trim(i.html()).replace(" ", "銆€"), s = $("
    " + i.html() + "
    ").css({fontSize: r}).appendTo($("body")), h = s.width(), o = nw||arr[1]||2 * parseInt(r); if (h > n) { var t = Math.floor(a.length * n / h), d = a.substring(0, t) + "..."; if ((h = s.text(d).width() + o) > n) for (; h > n && t > 1;) t--, d = a.substring(0, t) + "... ", h = s.text(d).width() + o; else if (n > h) { for (; n > h && t < a.length;) t++, d = a.substring(0, t) + "...", h = s.text(d).width() + o; h > n && (d = a.substring(0, t - 1) + "..."); } i.removeAttr("data-text-line").html(d.replace("銆€", " ")); } s.remove();oE.lined=!0; }); } function Y_BodyScroll(o){var r={contain:"html,body",goal:0,err:0,dur:400,cbk:null};o=$.extend({},r,o),ysq.shutDown=!0,$(o.contain).stop(!0,!1).animate({scrollTop:o.goal-o.err},o.dur,function(){ysq.shutDown=!1,o.cbk&&o.cbk()})} function Y_Tan(txt, options) { var opt={headWord:"鎻愮ず淇℃伅",callback:null,fnNo:null,fnYes:null,bAutoClose:!0,nTimeOut:1500,cls:" "};opt=$.extend({},opt,options); if (!ysq.HasTan[0]) {return a(txt), !1; } var bConfirm = opt.fnYes ? 1 : 0, bFlag = !0,timer; $(".TAlert").length&&$(".TAlert").remove(); var sDiv = '
    '+ '
    '+opt.headWord+'X
    '+ '
    '+ txt + '
    ', sDiv1 = ''; sDiv2 = ''; sDiv += bConfirm ? sDiv1 : sDiv2; sDiv += '
    '; $b.append(sDiv); bFlag && setVamCss(w.height(),"TAlert"); opt.bAutoClose&&ysq.HasTan[1]&&(timer=setTimeout(function(){fnCallBack(opt.fnNo);},opt.nTimeOut)); $(".TAlert").prepend(makeMask()).fadeIn(600,function(){ opt.callback&&opt.callback.call(this,$(".TAlert")); $(this).find(".close").off(TouchEd).on(TouchEd, function() { fnCallBack(opt.fnNo,$(this)); })}).addClass('showUp'); opt.fnYes&&$(".TAlert .enter").off(TouchEd).on(TouchEd, function() { fnCallBack(opt.fnYes,$(this)); }); w.resize(function(){bFlag && setVamCss(w.height(),"TAlert");}); $(document).keydown(function(e){bFlag&&e.keyCode==27&&fnCallBack(opt.fnNo);}); function fnCallBack(fn,$trigger){ysq.HasTan[1]&&clearTimeout(timer); $(".TAlert").addClass("hideOut"); setTimeout(function(){ $(".TAlert").fadeOut(333,function(){bFlag=!1;$(".TAlert,.cssTAlert").remove();fn&&fn.call(this,$trigger.length?$trigger:"");}); },400); } } /* basic Fn E*/ function hvGet(){ysq.horiz =(window.orientation==undefined)? w.width()>w.height():Math.abs(window.orientation%180)?!0:!1;} function GotWH(){ysq.Ww=Math.max(Math.min(w.width(), ysq.MaxW),ysq.MinW); } function ResizeD(n){var e="onorientationchange"in window?"orientationchange":"resize";window.addEventListener(e,n,!1)}