From 98789c98c8ed5714178404d99a4a7c57b5a519bb Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Wed, 16 Jan 2019 11:38:14 +0000 Subject: [PATCH] Reset onload flag when recalculate called This ensures sticky elements don't fade in if in a sticky position when the page loads. The fade is there to show when an element is becoming sticky. This has no use if it was already sticky the first time you see it. Because the same situation applies when recalculate is called, we also want the flag to be reset before this happens. --- app/assets/javascripts/stick-to-window-when-scrolling.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/stick-to-window-when-scrolling.js b/app/assets/javascripts/stick-to-window-when-scrolling.js index d18ccda41..16b1f5995 100644 --- a/app/assets/javascripts/stick-to-window-when-scrolling.js +++ b/app/assets/javascripts/stick-to-window-when-scrolling.js @@ -462,6 +462,9 @@ } if (numOfEls) { + // reset flag marking page load + this._initialPositionsSet = false; + $els.each(function (i, el) { // delay setting position until all stickys are loaded self.add(el, false, onLoaded);