Socket
Socket
Sign inDemoInstall

mouse-wheel

Package Overview
Dependencies
4
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mouse-wheel

Consistent cross browser mouse wheel movement


Version published
Weekly downloads
173K
increased by4.38%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

mouse-wheel

Consistent cross browser mouse wheel events. Test it out in your browser here.

Example

require('mouse-wheel')(function(dx, dy) {
  document.body.innerHTML = '<p>Scroll:' + [dx,dy] + '</p>'
})

Install

npm i mouse-wheel

API

require('mouse-wheel')(element, callback, noScroll)

Hook an event handler for the mouse wheel on element.

  • element is an optional DOM element, or if unspecified then is the window object.
  • callback(dx, dy, dz, ev) is called whenever the mouse scrolls
    • dx, dy, dz is the amount of scrolling vertically, horizontally and depth-wise in pixels
    • ev is the MouseEvent object associated with the event
  • noScroll is an optional flag, which if set disables scrolling the page

Returns listener function listener so that it may be detached later with element.removeEventListener('wheel', listener)

License

(c) 2015 Mikola Lysenko. MIT License

Keywords

FAQs

Last updated on 04 Jul 2016

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc