Skip to content

Scroll Interruption Interference

Sebastian Fuss edited this page May 28, 2016 · 1 revision

Using the pageScrollInterruptible attribute or the page-wide PageScrollConfig.defaultInterruptible configuration one can adjust whether user interactions should stop a running scroll animation. The detection is enabled by default. Whenever the user performs scroll related events (usage of mouse wheel or arrow keys) or events that indicate attempts to stop the scrolling (mouse click), the page scroll animation stops.

Technical implementation

To detect user interactions while a page scroll animation is running, event listeners are attached to the body element, listening for common events related to scrolling like mouse wheel, arrow keys or clicks (you may see the whole list in the code). Once the page scroll animation finishes the event listener are detached/removed. You may subscribe to the event emitter pageScrollFinish to execute custom logic whenever the scroll animation stops. Using the emitted boolean value you can distinguish between animations that finished due to reaching their target (value true is emitted) or because a user interruption (false is emitted).

Clone this wiki locally