lock-body-scroll
Lock/unlock body scrolling when modal is opened
Last updated 2 years ago by clarkdo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install lock-body-scroll 
SYNC missed versions from official npm registry.

Lock body scroll

Lock/unlock body scrolling when modal is opened.

Installation

$ yarn add lock-body-scroll

or

$ npm i lock-body-scroll

Usage

ES modules

import createLocker from 'lock-body-scroll'

const locker = createLocker()

// or

const locker = createLocker(options)

locker.lock()

locker.unlock()

CommonJS

const createLocker = require('lock-body-scroll')

const locker = createLocker()

locker.lock()

locker.unlock()

Browser

HTML:

<head>
  <script src="lock-body-scroll.min.js" />
</head>

JavaScript:

const locker = window.createLocker()

locker.lock()

locker.unlock()

Options

scrollElement

Default: document.scrollingElement || document.documentElement

The dom element which is for locking scrolling

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

2 Versions

  • 1.0.0                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |