JSPM

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

Trigger swipe-like events with mousewheel and trackpad

Package Exports

  • wheel-swipe

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 (wheel-swipe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

WheelSwipe

Trigger swipe-like events with mousewheel and trackpad. View the a demo here: https://andyinabox.github.io/wheel-swipe/

unstable

var WheelSwipe = require('wheel-swipe');

var ws = new WheelSwipe();

window.addEventListener('wheelup', function(e) { 
    console.log('swipe up!');
});

window.addEventListener('wheeldown', function(e) { 
    console.log('swipe down!');
});

Usage

NPM

WheelSwipe([el], [opts])

Construct a new instance.

  • el is the element to listen to. Optional, defaults to window object.
  • opts is also optional, contains the following settings:
  • deltaThreshold - threshold for scroll delta, can be used to only trigger when the scroll delta is a high number. Defaults to 1
  • debounceThreshold - threshold for scrolling debounce. Defaults to 50.
  • cancelScroll - Boolean, whether or not to cancel default scrolling behavior. Defaults to true.
  • reverseDelay - This sets a delay to avoid accidental reversals of swipe (can happen on some devices, namely the Apple Magic Mouse). Defaults to 0 (disabled).

Demo

To run the demo using budo:

npm install
npm start

Dependencies

License

MIT, see LICENSE.md for details.