1import gsap from"https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/gsap.js";const{getOffsetTop}=window.BAO.Utils;class ParallaxItems{constructor(){this.isTicking=!1,this.lastKnownY=window.scrollY,this.parallaxEls=document.querySelectorAll('[data-parallax-el="item"]'),this.parallaxEls.length!==0&&(this.requestTick=this.requestTick.bind(this),this.updateEl=this.updateEl.bind(this),this.setupElements(),this.updateEl(),this.setupListeners())}setupListeners(){this.onScroll=this.onScroll.bind(this),window.addEventListener("scroll",this.onScroll,{passive:!0})}onScroll(){this.lastKnownY=window.scrollY,this.requestTick()}requestTick(){this.isTicking||requestAnimationFrame(this.updateEl),this.isTicking=!0}updateEl(){this.isTicking=!1,this.moveParallaxItem()}moveParallaxItem(){this.parallaxEls.forEach(parallaxEl=>{if(parallaxEl.offsetParent===null)return;const windowHeight=window.innerHeight,amountToMove=parseFloat(parallaxEl.dataset.parallaxAmount),elementHeight=parallaxEl.offsetHeight,scaleAmount=amountToMove/elementHeight+1,heightDifference=elementHeight+amountToMove-elementHeight,elementStartPoint=getOffsetTop(parallaxEl)-windowHeight,elementEndPoint=getOffsetTop(parallaxEl)+elementHeight;if(this.lastKnownY<elementStartPoint){gsap.to(parallaxEl,1,{y:amountToMove/-2,scale:scaleAmount});return}if(this.lastKnownY>elementEndPoint){gsap.to(parallaxEl,1,{y:amountToMove/2,scale:scaleAmount});return}const totalScrollAmount=elementEndPoint-elementStartPoint,scrollYAsAPercentageOfJourney=(this.lastKnownY-elementStartPoint)/totalScrollAmount,transformAmount=heightDifference*scrollYAsAPercentageOfJourney-heightDifference/2;gsap.to(parallaxEl,1,{y:transformAmount,scale:scaleAmount})})}setupElements(){this.parallaxEls.forEach(parallaxEl=>{if(parallaxEl.offsetParent===null)return;const amountToMove=parseFloat(parallaxEl.dataset.parallaxAmount),elementHeight=parallaxEl.offsetHeight,scaleAmount=amountToMove/elementHeight+1;parallaxEl.style.setProperty("--ScaleAmount",scaleAmount)})}}window.BAO.parallaxItems=new ParallaxItems; 2//# sourceMappingURL=/cdn/shop/t/291/assets/parallax.js.map?v=109990696063741575701761906980
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.