/******************************************** * REVOLUTION 5.0 EXTENSION - PARALLAX * @version: 1.0.5 (20.10.2015) * @requires jquery.themepunch.revolution.js * @author ThemePunch *********************************************/ !function(){var e=jQuery.fn.revolution,r=e.is_mobile();jQuery.extend(!0,e,{checkForParallax:function(a,t){var o=t.parallax;return r&&"on"==o.disable_onmobile?!1:(("3D"==o.type||"3d"==o.type)&&(punchgs.TweenLite.set(t.c,{overflow:o.ddd_overflow}),punchgs.TweenLite.set(t.ul,{overflow:o.ddd_overflow}),"carousel"!=t.sliderType&&"on"==o.ddd_shadow&&(t.c.prepend('
'),punchgs.TweenLite.set(t.c.find(".dddwrappershadow"),{force3D:"auto",transformPerspective:1600,transformOrigin:"50% 50%",width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:0}))),t.li.each(function(){var e=jQuery(this);if("3D"==o.type||"3d"==o.type){e.find(".slotholder").wrapAll(''),e.find(".tp-parallax-wrap").wrapAll(''),e.find(".rs-parallaxlevel-tobggroup").closest(".tp-parallax-wrap").wrapAll('');var r=e.find(".dddwrapper"),a=e.find(".dddwrapper-layer"),l=e.find(".dddwrapper-layertobggroup");l.appendTo(r),"carousel"==t.sliderType&&("on"==o.ddd_shadow&&r.addClass("dddwrappershadow"),punchgs.TweenLite.set(r,{borderRadius:t.carousel.border_radius})),punchgs.TweenLite.set(e,{overflow:"visible",transformStyle:"preserve-3d",perspective:1600}),punchgs.TweenLite.set(r,{force3D:"auto",transformOrigin:"50% 50%"}),punchgs.TweenLite.set(a,{force3D:"auto",transformOrigin:"50% 50%",zIndex:5}),punchgs.TweenLite.set(t.ul,{transformStyle:"preserve-3d",transformPerspective:1600})}for(var s=1;s<=o.levels.length;s++)e.find(".rs-parallaxlevel-"+s).each(function(){var e=jQuery(this),r=e.closest(".tp-parallax-wrap");r.data("parallaxlevel",o.levels[s-1]),r.addClass("tp-parallax-container")})}),("mouse"==o.type||"scroll+mouse"==o.type||"mouse+scroll"==o.type||"3D"==o.type||"3d"==o.type)&&(a.mouseenter(function(e){var r=a.find(".active-revslide"),t=a.offset().top,o=a.offset().left,l=e.pageX-o,s=e.pageY-t;r.data("enterx",l),r.data("entery",s)}),a.on("mousemove.hoverdir, mouseleave.hoverdir, trigger3dpath",function(e,r){var l=r&&r.li?r.li:a.find(".active-revslide");if("enterpoint"==o.origo){var s=a.offset().top,i=a.offset().left;void 0==l.data("enterx")&&l.data("enterx",e.pageX-i),void 0==l.data("entery")&&l.data("entery",e.pageY-s);var d=l.data("enterx")||e.pageX-i,n=l.data("entery")||e.pageY-s,p=d-(e.pageX-i),c=n-(e.pageY-s),u=o.speed/1e3||.4}else var s=a.offset().top,i=a.offset().left,p=t.conw/2-(e.pageX-i),c=t.conh/2-(e.pageY-s),u=o.speed/1e3||3;if("mouseleave"==e.type&&(p=o.ddd_lasth||0,c=o.ddd_lastv||0,u=1.5),l.find(".tp-parallax-container").each(function(){var e=jQuery(this),r=parseInt(e.data("parallaxlevel"),0),a="3D"==o.type||"3d"==o.type?r/200:r/100,t=p*a,l=c*a;"scroll+mouse"==o.type||"mouse+scroll"==o.type?punchgs.TweenLite.to(e,u,{force3D:"auto",x:t,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(e,u,{force3D:"auto",x:t,y:l,ease:punchgs.Power3.easeOut,overwrite:"all"})}),"3D"==o.type||"3d"==o.type){var h=".tp-revslider-slidesli .dddwrapper, .dddwrappershadow, .tp-revslider-slidesli .dddwrapper-layer";"carousel"===t.sliderType&&(h=".tp-revslider-slidesli .dddwrapper, .tp-revslider-slidesli .dddwrapper-layer"),t.c.find(h).each(function(){var r=jQuery(this),a=o.levels[o.levels.length-1]/200,l=p*a,s=c*a,i=0==t.conw?0:Math.round(p/t.conw*a*100)||0,d=0==t.conh?0:Math.round(c/t.conh*a*100)||0,n=r.closest("li"),h=0,w=!1;r.hasClass("dddwrapper-layer")&&(h=o.ddd_z_correction||65,w=!0),r.hasClass("dddwrapper-layer")&&(l=0,s=0),n.hasClass("active-revslide")||"carousel"!=t.sliderType?"on"!=o.ddd_bgfreeze||w?punchgs.TweenLite.to(r,u,{rotationX:d,rotationY:-i,x:l,z:h,y:s,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(r,.5,{force3D:"auto",rotationY:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(r,.5,{force3D:"auto",rotationY:0,z:0,x:0,y:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}),"mouseleave"==e.type&&punchgs.TweenLite.to(jQuery(this),3.8,{z:0,ease:punchgs.Power3.easeOut})})}}),r&&(window.ondeviceorientation=function(e){var r=Math.round(e.beta||0)-70,l=Math.round(e.gamma||0),s=a.find(".active-revslide");if(jQuery(window).width()>jQuery(window).height()){var i=l;l=r,r=i}var d=a.width(),n=a.height(),p=360/d*l,c=180/n*r,u=o.speed/1e3||3;if(s.find(".tp-parallax-container").each(function(){var e=jQuery(this),r=parseInt(e.data("parallaxlevel"),0),a=r/100,t=p*a*2,o=c*a*4;punchgs.TweenLite.to(e,u,{force3D:"auto",x:t,y:o,ease:punchgs.Power3.easeOut,overwrite:"all"})}),"3D"==o.type||"3d"==o.type){var h=".tp-revslider-slidesli .dddwrapper, .dddwrappershadow, .tp-revslider-slidesli .dddwrapper-layer";"carousel"===t.sliderType&&(h=".tp-revslider-slidesli .dddwrapper, .tp-revslider-slidesli .dddwrapper-layer"),t.c.find(h).each(function(){var r=jQuery(this),a=o.levels[o.levels.length-1]/200;offsh=p*a,offsv=c*a*3,offrv=0==t.conw?0:Math.round(p/t.conw*a*500)||0,offrh=0==t.conh?0:Math.round(c/t.conh*a*700)||0,li=r.closest("li"),zz=0,itslayer=!1,r.hasClass("dddwrapper-layer")&&(zz=o.ddd_z_correction||65,itslayer=!0),r.hasClass("dddwrapper-layer")&&(offsh=0,offsv=0),li.hasClass("active-revslide")||"carousel"!=t.sliderType?"on"!=o.ddd_bgfreeze||itslayer?punchgs.TweenLite.to(r,u,{rotationX:offrh,rotationY:-offrv,x:offsh,z:zz,y:offsv,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(r,.5,{force3D:"auto",rotationY:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(r,.5,{force3D:"auto",rotationY:0,z:0,x:0,y:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}),"mouseleave"==e.type&&punchgs.TweenLite.to(jQuery(this),3.8,{z:0,ease:punchgs.Power3.easeOut})})}})),void e.scrollTicker(t,a))},scrollTicker:function(r,a){1!=r.scrollTicker&&(r.scrollTicker=!0,punchgs.TweenLite.ticker.fps(150),punchgs.TweenLite.ticker.addEventListener("tick",function(){e.scrollHandling(r)},a,!0,1))},scrollHandling:function(a){a.lastwindowheight=a.lastwindowheight||jQuery(window).height();var t=a.c.offset().top,o=jQuery(window).scrollTop(),l=new Object,s=a.viewPort,i=a.parallax;if(a.lastscrolltop==o)return!1;a.lastscrolltop=o,l.top=t-o,l.h=0==a.conh?a.c.height():a.conh,l.bottom=t-o+l.h;var d=l.top<0?l.top/l.h:l.bottom>a.lastwindowheight?(l.bottom-a.lastwindowheight)/l.h:0;a.scrollproc=d,e.callBackHandling&&e.callBackHandling(a,"parallax","start");var n=1-Math.abs(d);if(n=0>n?0:n,s.enable&&(1-s.visible_area<=n?a.inviewport||(a.inviewport=!0,e.enterInViewPort(a)):a.inviewport&&(a.inviewport=!1,e.leaveViewPort(a))),r&&"on"==a.parallax.disable_onmobile)return!1;var p=new punchgs.TimelineLite;p.pause(),"3d"!=i.type&&"3D"!=i.type&&(("scroll"==i.type||"scroll+mouse"==i.type||"mouse+scroll"==i.type)&&a.c.find(".tp-parallax-container").each(function(){var e=jQuery(this),r=parseInt(e.data("parallaxlevel"),0)/100,t=d*-(r*a.conh);e.data("parallaxoffset",t),p.add(punchgs.TweenLite.set(e,{force3D:"auto",y:t}),0)}),a.c.find(".tp-revslider-slidesli .slotholder, .tp-revslider-slidesli .rs-background-video-layer").each(function(){var e=jQuery(this),r=e.data("bgparallax")||a.parallax.bgparallax;if(r="on"==r?1:r,void 0!==r||"off"!==r){var t=a.parallax.levels[parseInt(r,0)-1]/100,o=d*-(t*a.conh);jQuery.isNumeric(o)&&p.add(punchgs.TweenLite.set(e,{position:"absolute",top:"0px",left:"0px",backfaceVisibility:"hidden",force3D:"true",y:o+"px",overwrite:"auto"}),0)}})),e.callBackHandling&&e.callBackHandling(a,"parallax","end"),p.play(0)}})}(jQuery);