{ "version": 3, "sources": ["../../src/js/testimonials-parallax_cards.js"], "sourcesContent": ["const section = document.querySelector('.testimonials-parallax_cards')\nconst cards = section.querySelectorAll('.card-wrapper')\n\nconst observeSection = (entries, observer) => {\n\tentries.forEach(entry => {\n\t\tif (entry.isIntersecting) {\n\t\t\twindow.addEventListener('scroll', moveCards)\n\t\t} else {\n\t\t\twindow.removeEventListener('scroll', moveCards)\n\t\t}\n\t})\n}\n\nconst moveCards = () => {\n\tlet box = section.getBoundingClientRect()\n\tlet middle = (window.innerHeight - box.height) / 2\n\tlet positionConstant = (box.top - middle) * 0.1\n\n\tcards.forEach(card => {\n\t\tlet speed = parseFloat(card.dataset.speed)\n\n\t\tcard.setAttribute(\n\t\t\t'style',\n\t\t\t`transform: translateY(${speed * positionConstant}px);`\n\t\t)\n\t})\n}\n\nconst resetCards = () => {\n\tcards.forEach(card => {\n\t\tcard.setAttribute('style', '')\n\t})\n}\n\nconst observer = new IntersectionObserver(observeSection)\nlet observerHandle = null\n\nif (window.innerWidth >= 1200) {\n\tobserverHandle = observer.observe(section)\n}\n\nwindow.addEventListener('resize', () => {\n\tif (window.innerWidth >= 1200 && !observerHandle) {\n\t\tobserverHandle = observer.observe(section)\n\t} else if (window.innerWidth < 1200) {\n\t\tobserver.unobserve(section)\n\t\tobserverHandle = null\n\t\twindow.removeEventListener('scroll', moveCards)\n\t\tresetCards()\n\t}\n})\n"], "mappings": "mBAAA,IAAMA,EAAU,SAAS,cAAc,8BAA8B,EAC/DC,EAAQD,EAAQ,iBAAiB,eAAe,EAEhDE,EAAiB,CAACC,EAASC,IAAa,CAC7CD,EAAQ,QAAQE,GAAS,CACpBA,EAAM,eACT,OAAO,iBAAiB,SAAUC,CAAS,EAE3C,OAAO,oBAAoB,SAAUA,CAAS,CAEhD,CAAC,CACF,EAEMA,EAAY,IAAM,CACvB,IAAIC,EAAMP,EAAQ,sBAAsB,EACpCQ,GAAU,OAAO,YAAcD,EAAI,QAAU,EAC7CE,GAAoBF,EAAI,IAAMC,GAAU,GAE5CP,EAAM,QAAQS,GAAQ,CACrB,IAAIC,EAAQ,WAAWD,EAAK,QAAQ,KAAK,EAEzCA,EAAK,aACJ,QACA,yBAAyBC,EAAQF,OAClC,CACD,CAAC,CACF,EAEMG,EAAa,IAAM,CACxBX,EAAM,QAAQS,GAAQ,CACrBA,EAAK,aAAa,QAAS,EAAE,CAC9B,CAAC,CACF,EAEMN,EAAW,IAAI,qBAAqBF,CAAc,EACpDW,EAAiB,KAEjB,OAAO,YAAc,OACxBA,EAAiBT,EAAS,QAAQJ,CAAO,GAG1C,OAAO,iBAAiB,SAAU,IAAM,CACnC,OAAO,YAAc,MAAQ,CAACa,EACjCA,EAAiBT,EAAS,QAAQJ,CAAO,EAC/B,OAAO,WAAa,OAC9BI,EAAS,UAAUJ,CAAO,EAC1Ba,EAAiB,KACjB,OAAO,oBAAoB,SAAUP,CAAS,EAC9CM,EAAW,EAEb,CAAC", "names": ["section", "cards", "observeSection", "entries", "observer", "entry", "moveCards", "box", "middle", "positionConstant", "card", "speed", "resetCards", "observerHandle"] }