• Stars
    star
    178
  • Rank 213,893 (Top 5 %)
  • Language
    HTML
  • Created over 11 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

hamster.wheel(function(event, delta, deltaX, deltaY){
  console.log(delta, deltaX, deltaY);
});

// destroy
hamster.unwheel();

Support

No jQuery or other libraries required, but an adapter for AngularJS is available.

Tested in these core browsers.

Install

bower install hamsterjs

Demo

monospaced.github.io/hamster.js

Reference