Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Fixes #2297
The sticky element was 'flashing' when positioned at the bottom of the area. This was due to the element being constantly switched between the sticky and non-sticky states.
This was an interesting bug. There is a function called on scroll that sets
this.hasScrolled
and a second functioncheckScroll
called on an interval that checks to see ifthis.hasScrolled
is true, updates the sticky element as appropriate, then sets it back to false, ready for the next scroll.The function
checkResize
checks and then sets the equivalentthis.hasResized
to false.checkResize
also setsthis.hasScrolled
to true, in order to triggercheckScroll
(because resizing can change the height of the page). A change to make this code fit our module pattern had updatedcheckScroll
to also setthis.hasResized
to true (to matchcheckResize
). Unfortunately this had the effect of both functions constantly triggering each other. Unnoticed, the functions attached to the window scroll and resize events hadn't had the proper.bind(this)
applied, which meant that the code was seemingly working, but not at all as expected.Example pages:
Why
Visual changes
None.