@kensingtontech/hamsterjs

A standalone javascript library for cross-browser mouse wheel support

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
1745Mar 31, 2020Mar 21, 2013Minified + gzip package size for @kensingtontech/hamsterjs in KB

Readme

Hamster.js

A standalone javascript library for cross-browser mouse wheel support.

See it in action.

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

Reference

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.