diff --git a/src/ui/ScrollEffects.js b/src/ui/ScrollEffects.js index cc2d655..6387ce7 100644 --- a/src/ui/ScrollEffects.js +++ b/src/ui/ScrollEffects.js @@ -1,6 +1,8 @@ export class ScrollEffects { constructor() { this.init(); + this.setupParallax(); + this.observers = []; } init() { @@ -24,6 +26,7 @@ export class ScrollEffects { document.querySelectorAll('.section, [data-parallax]').forEach(el => { observer.observe(el); }); + this.observers.push(observer); } setupParallaxForElement(element) { @@ -37,6 +40,12 @@ export class ScrollEffects { window.addEventListener('scroll', handleScroll); } + + dispose() { + this.observers.forEach(observer => observer.disconnect()); + this.observers = []; + window.removeEventListener('scroll', this.handleScroll); + } } function buildThresholdList() {