From d3df85a2949c547ae6f9accfc75364f2fd0a02ee Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Fri, 26 Nov 2021 09:06:50 +0000 Subject: [PATCH] Fixes issue #2297 --- app/assets/javascripts/modules/sticky-element-container.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/modules/sticky-element-container.js b/app/assets/javascripts/modules/sticky-element-container.js index 114011c2c..a61884d1e 100644 --- a/app/assets/javascripts/modules/sticky-element-container.js +++ b/app/assets/javascripts/modules/sticky-element-container.js @@ -26,8 +26,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; StickyElementContainer.prototype.init = function () { if (!this.stickyElement) return - window.onresize = this.onResize - window.onscroll = this.onScroll + window.onresize = this.onResize.bind(this) + window.onscroll = this.onScroll.bind(this) setInterval(this.checkResize.bind(this), this.interval) setInterval(this.checkScroll.bind(this), this.interval) this.checkResize() @@ -71,7 +71,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; StickyElementContainer.prototype.checkScroll = function () { if (this.hasScrolled) { this.hasScrolled = false - this.hasResized = true this.windowVerticalPosition = this.getWindowPositions().scrollTop