Skip to content

substrate-system/raf-scroll

Repository files navigation

raf scroll

tests dependencies types module install size gzip size license

Scroll events, debounced with requestAnimationFrame.

Contents

Install

npm i -S @substrate-system/raf-scroll

Example

import { rafScroll } from '@substrate-system/raf-scroll'

rafScroll(ev => {
    // this is called at most once per animation frame
    console.log('scroll event', ev)
})

Modules

This exposes ESM and common JS via package.json exports field.

Bundler

Import like normal.

import { rafScroll } from '@substrate-system/raf-scroll'

Minified

This package exposes minified JS too. Copy to a location that is accessible to your web server, then link to it in HTML.

copy

cp ./node_modules/@substrate-system/raf-scroll/dist/index.min.js ./public/raf-scroll.min.js

HTML

<script type="module" src="./raf-scroll.min.js"></script>

About

Scroll events debounced with requestAnimationFrame

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •