b-scroll-lock [all b- libs]
Bornfight Studio frontend micro lib for locking and unlocking the scroll
- install
b-scroll-lock
trough npm or pull ti from git
npm i @bornfight/b-scroll-lock
- include b-lib to your JS after running npm install
import ScrollLock from "@bornfight/b-scroll-lock";
- class contains two methods, one for lock scroll and one for unlock
- every method has one property that could be passed
const scrollLock = new ScrollLock();
// value 100 represent on witch scroll value will "is-fixed-scrolled" class be added to body
// offset value (100) is optional and default is 100
scrollLock.lockScroll(100);
// value 100 represent on witch scroll value will document be after scroll is unlocked
// offset value (100) is optiona and default is scroll value before locking the scroll
scrollLock.unlockScroll(100);
- if used with page transition - don't forget to unlock scroll
- will not work for scroll inside modal/popup
- Gulp 4 used
- browsersync for live reload
npm run dev - dev environent with browsersync
MIT © Bornfight Studio