{"version":3,"sources":["promo-block.js"],"names":["PromoBlock","constructor","container","options","this","Object","assign","document","querySelector","blocks","querySelectorAll","setEvents","animateBlock","offset","window","innerWidth","forEach","block","classList","remove","observer","IntersectionObserver","entries","entry","isIntersecting","add","unobserve","root","threshold","rootMargin","observe"],"mappings":"qBAAqBA,WACnBC,YAAYC,EAAWC,GAIrBC,KAAKD,QAAUE,OAAOC,OAAO,GAHN,GAG0BH,CAAO,EACxDC,KAAKF,UAAYK,SAASC,cAAcN,CAAS,EACjDE,KAAKK,OAASL,KAAKF,UAAUQ,iBAAiB,mBAAmB,EAEjEN,KAAKO,UAAU,CACjB,CAEAA,YACEP,KAAKQ,aAAa,CACpB,CAEAA,eACE,MAAMC,EAA8B,KAArBC,OAAOC,WAAoB,SAAW,MAErDX,KAAKK,OAAOO,QAAQC,IAClBA,EAAMC,UAAUC,OAAO,iBAAiB,EAExC,MAAMC,EAAW,IAAIC,qBAAqBC,IACxCA,EAAQN,QAAQO,IACVA,EAAMC,gBACRP,EAAMC,UAAUO,IAAI,iBAAiB,EACrCL,EAASM,UAAUT,CAAK,GAExBA,EAAMC,UAAUC,OAAO,iBAAiB,CAE5C,CAAC,CACH,EAAG,CACDQ,KAAM,KACNC,UAAW,MACXC,WAAYhB,CACd,CAAC,EAEDO,EAASU,QAAQb,CAAK,CACxB,CAAC,CACH,CACF","file":"promo-block.min.js","sourcesContent":["export default class PromoBlock {\r\n constructor(container, options) {\r\n const defaultOptions = {\r\n }\r\n\r\n this.options = Object.assign({}, defaultOptions, options)\r\n this.container = document.querySelector(container)\r\n this.blocks = this.container.querySelectorAll('.promo-tiles-tile')\r\n\r\n this.setEvents()\r\n }\r\n\r\n setEvents() {\r\n this.animateBlock()\r\n }\r\n\r\n animateBlock() {\r\n const offset = window.innerWidth >= 768 ? '-200px' : '0px'\r\n \r\n this.blocks.forEach(block => {\r\n block.classList.remove('tile-transition')\r\n \r\n const observer = new IntersectionObserver(entries => {\r\n entries.forEach(entry => {\r\n if (entry.isIntersecting) {\r\n block.classList.add('tile-transition')\r\n observer.unobserve(block)\r\n } else {\r\n block.classList.remove('tile-transition')\r\n }\r\n })\r\n }, {\r\n root: null,\r\n threshold: 0.00000000001,\r\n rootMargin: offset\r\n });\r\n \r\n observer.observe(block)\r\n })\r\n }\r\n}"]}