@kensingtontech/hamsterjs
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @kensingtontech/hamsterjs

      Weekly Downloads

      10

      Version

      1.1.6

      License

      MIT

      Unpacked Size

      11.8 kB

      Total Files

      4

      Last publish

      Collaborators

      • kensingtontech