JSPM

@kensingtontech/hamsterjs

1.1.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q40742F
  • License MIT

A standalone javascript library for cross-browser mouse wheel support

Package Exports

  • @kensingtontech/hamsterjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kensingtontech/hamsterjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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