scroll-debounce

1.0.2 • Public • Published

scroll-debounce

Window.scroll events fire on every pixel scrolled; this kills performance. This script will allow you to add functions to an array which will fire once every 100 milliseconds (or timing of your choice) if the page is scrolled.

With this script the if you scroll 1000 pixels in one second at most your functions fire 10 times; without it they fire 1000 times.

Install

With npm do:

npm install --save-dev scroll-debounce

How to use scroll-debounce

Using your favorite JavaScript module bundler, such as browserify require scrollDebounce, add your functions and run the init function.

More Documentation and Examples Coming Soon

To-do

  • Write Unit Tests
  • Write Documentation
  • Create example code to show this in action
  • Lint code
  • Drink more coffee

Package Sidebar

Install

npm i scroll-debounce

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • designbyblake