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

dontscrollthebody

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dontscrollthebody

Prevent scroll in HTML parent element

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

dont-scroll-the-body

A minimalist JavaScript library that prevents scroll in the HTML parent element (including the <body>) when reaching the scroll end of a child element.

See it in action

  • http://jsfiddle.net/ibcaliax/bwmzfmq7/9/

Installation

$ npm install dontscrollthebody

or:

$ bower install dontscrollthebody

Usage

In Node/browserify/CommonJS environments:

var dontscrollthebody = require('dontscrollthebody');

The library installed via Bower is a "browserified" bundle so it exports window.dontscrollthebody or the corresponding AMD mechanism.

API

dontscrollthebody(elem)

Prevents the DOM wheel event to be propagated to parent elements when reaching the end of the given elem.

  • elem must be an HTML node.
var myContainer = body.querySelector('.myContainer');

dontscrollthebody(myContainer);
dontscrollthebody.remove(elem)

Removes the previously added wheel listener.

  • elem must be an HTML node.
dontscrollthebody.remove(myContainer);

Author

Iñaki Baz Castillo (@ibc at Github)

License

MIT

Keywords

FAQs

Package last updated on 24 Apr 2016

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