Skip to content

Ignoring scroll events if scrollTop hasn't changed

Compare
Choose a tag to compare
@src-code src-code released this 02 Jun 16:40

If a scrollStart event is received but the scrollTop value doesn't seem to have changed from the cached value, skip handling the event and the subsequent scroll event. This fixes an issue seen when the document's scroll position is being restored (eg, during a page navigation event in a single page app) and sticky may incorrectly attempt to reposition itself due to the scroll event.