An open API service indexing awesome lists of open source software.

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

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 );
```