https://github.com/recursivefunk/skrole
Light-weight, high-performance, dependency-free scroll handling for the browser
https://github.com/recursivefunk/skrole
Last synced: 4 months ago
JSON representation
Light-weight, high-performance, dependency-free scroll handling for the browser
- Host: GitHub
- URL: https://github.com/recursivefunk/skrole
- Owner: recursivefunk
- Created: 2014-08-27T18:22:34.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-06-05T17:04:40.000Z (about 11 years ago)
- Last Synced: 2026-02-21T12:41:50.938Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 148 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Skrole doesn't perform any operations on the window scroll event, which can be detrimental to performance. Instead it passes the computation onto requestAnimationFrame. It falls back to setInterval if requestAnimationFrame is unavailable.
```javascript
skrole(function( direction ){
console.log( 'you srolled ' + direction );
})
.idle(2000, function(){
console.log( 'it has been 2 seconds since the last scroll event' );
// 2 seconds is the default, you can likewise just pass in a callback
// as the first argument or provide a different value
});
setTimeout( skrole.destroy, 5000 );
```