Scroll visible elements to add CSS
MIT License
https://xjh22222228.github.io/class-scroll
npm install class-scroll
# or
yarn add class-scroll
# or
pnpm add class-scroll
import ClassScroll from 'class-scroll'
const classScroll = new ClassScroll([
el: '#app',
className: 'animate__animated animate__fadeIn',
threshold: 0.5,
delay: 0,
]).init()
Fields | Descriptions | Type |
---|---|---|
el |
required Node or selector |
Element / String |
className |
required The class that needs to be added when the element is visible |
String |
delay | Delay adding class | Number |
threshold | threshold | Number / Number[] |
root | root | Element / Document / null |
rootMargin | rootmargin | Element / String |
onVisible | Callback method when element is visible | Function |
onHidden | Callback method when element is not visible | Function |