@kensingtontech/hamsterjs
v1.1.6
Published
A standalone javascript library for cross-browser mouse wheel support
Downloads
30
Maintainers
Readme
Hamster.js
A standalone javascript library for cross-browser mouse wheel support.
Usage
The event callback receives 3 extra arguments which are the normalized “deltas” of the mouse wheel.
var hamster = Hamster(el, false); // boolean is whether passive = true | false
hamster.wheel(function(event, delta, deltaX, deltaY){
console.log(delta, deltaX, deltaY);
});
// destroy
hamster.unwheel();
Support
The second parameter to Hamster() is optional, and indicates whether to mark the event listener as passive, for performance. Please do your research about passive event listeners before turning this on.
No jQuery or other libraries are required, but an adapter for AngularJS is available.
Tested in these core browsers.
Install
npm install hamsterjs
bower install hamsterjs
Demo
monospaced.github.io/hamster.js