1.0.9 • Published 2 years ago
@hornbeck/scroll-lock v1.0.9
@hornbeck/scroll-lock
Simple and lightweight scroll lock for react and vanilla js.
npm install --save @hornbeck/scroll-lock
Documentation
React hook
import { useScrollLock } from "@hornbeck/scroll-lock";
function App() {
const [lockScroll, setLockScroll] = React.useState(false);
useScrollLock(lockScroll);
}
Vanilla js
import { scrollLock } from "@hornbeck/scroll-lock";
// Turn on scroll lock.
const off = scrollLock();
// Turn off scroll lock.
off();