Body scroll locking that just works with everything
npm install ultimate-body-scroll-lockFork of https://github.com/tuateam/tua-body-scroll-lock
Fixes the scroll locking on desktop
> inspired by body-scroll-lock
English | 简体中文
tua-body-scroll-lock enables body scroll locking for everything.``bash`
$ npm i -S tua-body-scroll-lockOR
$ yarn add tua-body-scroll-lock
`js
import { lock, unlock } from 'tua-body-scroll-lock'
lock()
unlock()
`
In some scenarios, when scrolling is prohibited, some elements still need to scroll, at this point, pass the targetElement.
`js
import { lock, unlock } from 'tua-body-scroll-lock'
const targetElement = document.querySelector("#someElementId")
lock(targetElement)
unlock(targetElement)
`
> The targetElement` is not required on the PC and Android.
Thanks goes to these wonderful people (emoji key):
evinma 💻 📖 | StEve Young 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!