Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wheel-indicator

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wheel-indicator

normalizes an inertial mousewheel

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
297
increased by96.69%
Maintainers
2
Weekly downloads
 
Created
Source

wheel-indicator

Indicates when user makes swipe gesture on a trackpad or mouse wheel.

Build Status

trackpad

Installing

npm i -S wheel-indicator

or oldschool method:

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

Usage

var WheelIndicator = require('wheel-indicator'); // ← if you use build system

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

FieldTypeDefault valueMutable (by setOptions())Description
elemObject (dom node)documentNoDOM node to listen wheel event on.
callbackFunction-YesThe 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'.
preventMouseBooltrueYesDisables mouse wheel working. In other words applies preventDefault() to wheel event.

Instance methods

MethodDescription
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.

Keywords

FAQs

Package last updated on 27 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc