From 42c63c4ef141e18cbf459049e996c2c9d57089f0 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Fri, 17 Mar 2023 18:30:37 +0000 Subject: [PATCH 1/2] Fix: Prevent scrolling of container (fixes #254) --- js/NarrativeView.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/NarrativeView.js b/js/NarrativeView.js index 28fc72e..eae7e71 100644 --- a/js/NarrativeView.js +++ b/js/NarrativeView.js @@ -111,6 +111,8 @@ class NarrativeView extends ComponentView { if (Adapt.config.get('_disableAnimation')) { this.$el.addClass('disable-animation'); } + + this.$('.narrative__slide-container')[0].addEventListener('scroll', this.onScroll, true); } setupNarrative() { @@ -344,6 +346,10 @@ class NarrativeView extends ComponentView { this.setupInviewCompletion('.component__widget'); } } + + preRemove() { + this.$('.narrative__slide-container')[0].removeEventListener('scroll', this.onScroll, true); + } } NarrativeView.template = 'narrative'; From 0f4874dfdae71d97db1e58f1d594b32d57bd5ce7 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Fri, 24 Mar 2023 14:46:03 +0000 Subject: [PATCH 2/2] Update NarrativeView.js --- js/NarrativeView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/NarrativeView.js b/js/NarrativeView.js index 6a6c137..657bf00 100644 --- a/js/NarrativeView.js +++ b/js/NarrativeView.js @@ -81,7 +81,7 @@ class NarrativeView extends ComponentView { this.setupNarrative(); this.$('.narrative__slider').imageready(this.setReadyStatus.bind(this)); - this.$('.narrative__slide-container')[0].addEventListener('scroll', this.onScroll, true); + this.$('.narrative__slide-container')[0]?.addEventListener('scroll', this.onScroll, true); } setupNarrative() { @@ -322,7 +322,7 @@ class NarrativeView extends ComponentView { } preRemove() { - this.$('.narrative__slide-container')[0].removeEventListener('scroll', this.onScroll, true); + this.$('.narrative__slide-container')[0]?.removeEventListener('scroll', this.onScroll, true); } }