normalizes an inertial mousewheel
npm install wheel-indicator[![Build Status][travis-image]][travis-url]
bash
npm i -S wheel-indicator
`
or oldschool method:
`html
`Usage
`javascript
var WheelIndicator = require('wheel-indicator'); // ← if you use build systemvar indicator = new WheelIndicator({
elem: document.querySelector('.element'),
callback: function(e){
console.log(e.direction) // "up" or "down"
}
});
//The method call
indicator.getOption('preventMouse'); // true
`API
$3
| Field | Type | Default value | Mutable (by setOptions()) | Description |
| ------- | --------- | ----------- | ---- | ---------------------------------------- |
| elem | Object (dom node) | document | No | DOM node to listen wheel event on. |
| callback | Function | - | Yes | The callback, which will be triggered on gesture. Gets for the first argument a native wheel event object, extended by direction property, taking value 'up' or 'down'. |
| preventMouse | Bool | true | Yes | Disables mouse wheel working. In other words applies preventDefault() to wheel event. | $3
| Method | Description |
| ------- | ---------------------------------------- |
| turnOff() | Turns off callback triggering. |
| turnOn() | Turns on callback trigerring. |
| setOptions(options) | Sets the mutable options. The only argument must be Object. |
| getOption('option') | Returns option value. The only argument must be String. |
| destroy()` | Removes event listener. |[travis-url]: http://travis-ci.org/Promo/wheel-indicator
[travis-image]: http://img.shields.io/travis/Promo/wheel-indicator.svg?branch=master&style=flat