@vkgp/scroll-indicator
v1.0.4
Published
Add body classes to indicate scroll statement
Readme
This package provide automatic classes on body to indicate scroll statement.
You can use them for manage sticky elements as menus or quick links display in CSS only.
Install
To install package, run npm install @vkgp/scroll-indicator.
Usage
import { ScrollIndicator } from '@vkgp/scroll-indicator';
const scrollIndicator = new ScrollIndicator();
scrollIndicator.start();Available classes
- body.scrolled: window is scrolled, top offset y is greater than 0
- body.scroll-to-bottom: user is, or its last scroll action was, scrolling down the window
- body.scrolling-to-top: user is, or its last scroll action was, scrolling up the window. Special treatment for avoiding bouncing on Apple devices when top is reached.
