{"version":3,"file":"script.js","mappings":"yBAAO,IAAMA,EAAe,SAACC,EAAIC,GAAgC,IAAAC,EAAtBC,EAASC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAC7CG,EAAQC,WAAWR,SAAW,QAATE,EAAFF,EAAIS,eAAO,IAAAP,OAAA,EAAXA,EAAaK,SAAW,EAC3CG,EAAgBP,GAAaQ,OAAOC,QACpCC,EAAeF,OAAOG,YACtBC,EAAed,aAAQ,EAARA,EAAUe,aACzBC,EAAkBhB,aAAQ,EAARA,EAAUiB,UAG5BC,EAAYT,EAAgBG,EAGlC,GAAIM,EAAYF,GAAmBP,EAAgBO,EAAkBF,EAAc,CAElF,IAIIK,GAJgBD,EAAYF,GAAmBV,GAEpCM,EAAeE,GAEW,KAAQ,GAAc,GAARR,GAGvDP,EAAGqB,MAAMC,IAAMF,EAAa,IAC5BpB,EAAGqB,MAAME,UAAY,oBAAsBH,EAAa,IACzD,CACD,ECpBAI,SAASC,iBAAiB,oBAAoB,WACzBD,SAASE,iBAAiB,0BAClCC,SAAQ,SAAAC,GACnB,IAAMC,EAAgBD,EAAWE,cAAc,mBAE3CD,IACH9B,EAAa8B,EAAeA,EAAcE,eAE1CP,SAASC,iBAAiB,UAAU,WACnC1B,EAAa8B,EAAeA,EAAcE,cAC3C,IAEF,GACD,G","sources":["webpack://parallax-section/./src/utils/functions.js","webpack://parallax-section/./src/script.js"],"sourcesContent":["export const parallaxInit = (el, parentEl, scrollTop = false) => {\r\n\tconst speed = parseFloat(el?.dataset?.speed) || -1;\r\n\tconst windowScrollY = scrollTop || window.scrollY;\r\n\tconst windowHeight = window.innerHeight;\r\n\tconst parentHeight = parentEl?.clientHeight;\r\n\tconst parentOffsetTop = parentEl?.offsetTop;\r\n\r\n\t// The next pixel to show on screen\r\n\tconst winBottom = windowScrollY + windowHeight;\r\n\r\n\t// If block is shown on screen\r\n\tif (winBottom > parentOffsetTop && windowScrollY < parentOffsetTop + parentHeight) {\r\n\t\t// Number of pixels shown after block appear\r\n\t\tconst imgBottom = ((winBottom - parentOffsetTop) * speed);\r\n\t\t// Max number of pixels until block disappear\r\n\t\tconst imgTop = windowHeight + parentHeight;\r\n\t\t// Percentage between start showing until disappearing\r\n\t\tlet imgPercent = ((imgBottom / imgTop) * 100) + (50 - (speed * 50));\r\n\r\n\t\t// Set the style\r\n\t\tel.style.top = imgPercent + '%';\r\n\t\tel.style.transform = 'translate(-50%, -' + imgPercent + '%)';\r\n\t}\r\n}","import './style.scss';\r\nimport { parallaxInit } from './utils/functions';\r\n\r\ndocument.addEventListener('DOMContentLoaded', () => {\r\n\tconst parallaxEls = document.querySelectorAll('.wp-block-psb-parallax');\r\n\tparallaxEls.forEach(parallaxEl => {\r\n\t\tconst parallaxImgEl = parallaxEl.querySelector('.psbParallaxImg');\r\n\r\n\t\tif (parallaxImgEl) {\r\n\t\t\tparallaxInit(parallaxImgEl, parallaxImgEl.parentElement);\r\n\r\n\t\t\tdocument.addEventListener('scroll', () => {\r\n\t\t\t\tparallaxInit(parallaxImgEl, parallaxImgEl.parentElement);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n});"],"names":["parallaxInit","el","parentEl","_el$dataset","scrollTop","arguments","length","undefined","speed","parseFloat","dataset","windowScrollY","window","scrollY","windowHeight","innerHeight","parentHeight","clientHeight","parentOffsetTop","offsetTop","winBottom","imgPercent","style","top","transform","document","addEventListener","querySelectorAll","forEach","parallaxEl","parallaxImgEl","querySelector","parentElement"],"sourceRoot":""}