@modernice/appeared
v0.2.1
Published
Track DOM elements scrolling in and out of the view.
Downloads
1
Maintainers
Readme
appeared.js
Simple tracking of DOM elements scrolling in and out of the view.
Install
Package Manager
yarn add @modernice/appeared // npm install @modernice/appeared --save
CDN
Modern version
<script src="https://unpkg.com/@modernice/appeared"></script>
Use
import appeared from '@modernice/appeared'
const stop = appeared('#trigger', {
multiple: true,
appear: (el: Element, count: number) => {
console.log(`element appeared ${count} times.`)
},
disappear: (el: Element, count: number) => {
console.log(`element disappeared ${count} times.`)
}
})
// disconnect the underlying IntersectionObserver
stop()