@bornfight/b-scroll-lock
v1.0.9
Published
Bornfight Studio frontend micro lib for scroll locking an unlocking
Downloads
36
Readme
b-scroll-lock [all b- libs]
Bornfight Studio frontend micro lib for locking and unlocking the scroll
📦 Getting Started
- 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
🔨️ Usage
JS
import ScrollLock from "@bornfight/b-scroll-lock";
Usage tips
- class contains two methods, one for lock scroll and one for unlock
- every method has one property that could be passed
💎 Customization
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);
🚀 Useful to know
- if used with page transition - don't forget to unlock scroll
- will not work for scroll inside modal/popup
📦 Contribute
Gulp based system
- Gulp 4 used
- browsersync for live reload
npm run dev - dev environent with browsersync
License
MIT © Bornfight Studio