@lingcz/scroll-lock

1.0.1 • Public • Published

安装

npm i @lingcz/lock-scroll
# or
yarn add @lingcz/lock-scroll

使用

import { lock, unlock, clearLock } from '@lingcz/lock-scroll'

//默认锁住body滚动
lock()

//解除锁定
unlokc()

//多次锁定
lock()
lock()

//解除
unlock()

//解除了一次,此时还是不能滚动
//再解除一次
unlock()
//可以滚动

clearLock() //清除所有锁定
  • 指定元素
import { lock, unlock, clearLock } from '@lingcz/lock-scroll'

const el = document.getElementById('box')

lock(el)

unlock(el)

//可以传一个数组

// lock([el1,el2...])

Readme

Keywords

Package Sidebar

Install

npm i @lingcz/scroll-lock

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

13.8 kB

Total Files

8

Last publish

Collaborators

  • lingcz