in src/lib/helpers/scrollyteller.js [4:30]
constructor(config) {
this.scrollWrapper = config.parent.querySelector(".scroll-wrapper")
const emptyWrapperHeight = this.scrollWrapper.getBoundingClientRect().height
const quarter = window.innerHeight * 0.25
config.parent.querySelectorAll('.scroll-text__div').forEach(el => {
const elHeight = el.getBoundingClientRect().height
el.parentElement.style.height = elHeight > quarter ? emptyWrapperHeight + elHeight - quarter + 'px' : emptyWrapperHeight + 'px'
})
this.isMobile = window.innerWidth < 740;
this.triggerTop = (!this.isMobile) ? config.triggerTop : config.triggerTopMobile;
this.scrollInner = config.parent.querySelector(".scroll-inner");
this.scrollText = config.parent.querySelector(".scroll-text");
this.lastScroll = null;
this.lastI = null;
this.triggerPoints = [];
this.textBoxes = [].slice.apply(this.scrollText.querySelectorAll(".scroll-text__inner"));
this.transparentUntilActive = config.transparentUntilActive;
this.scrollWrapper.style.height = this.textBoxes.map(d => d.getBoundingClientRect().height).reduce((a, b) => a + b) + "px";
this.boxesTops = this.textBoxes.map(d => d.getBoundingClientRect().top)
this.initialScrollTop = this.scrollText.getBoundingClientRect().top
if (this.transparentUntilActive) {
config.parent.classList.add("transparent-until-active");
}
}