Skip to content

gillesgoetsch/wheel-indicator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wheel-indicator

Generates event when user makes new movement (like a touchstart on a touchscreen).

Build Status

trackpad

Connection

<script src="wheel-indicator.js"></script>

or if you use build system:

var WheelIndicator = require('wheel-indicator');

Usage

  var 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

Options

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 apply preventDefault() to wheel event.

Instance methods

| Method | Description | | ------- | ------- | ---------------------------------------- | | turnOff() | Turn off callback triggering | | turnOn() | Turn 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. |

Packages

No packages published

Languages

  • JavaScript 97.5%
  • HTML 2.5%