2.1.5 • Published 6 years ago
sss-leash v2.1.5
About
Leash is a Browser scrollbar helper (Disable/Enable by X and Y).
Installation
1) Download Leash
2) Connect Leash before your scripts.
3) See how to create the Leash.
<script src="/assets/js/lib/Leash.js"></script>Package managers 😎
If you are using package managers such as npm or yarn, import this lib as usual.
# Yarn
yarn add sss-leash
# NPM
npm i sss-leash --saveDo import Leash from 'sss-leash';
Init
Create new Leash
const body = document.body;
const ScrollLeash = new Leash(body);Methods
Lock
Lock scroll X or Y
ScrollLeash.lockX();
ScrollLeash.lockY();If you are facing jumps in
position:fixedelements, add[data-scroll-fixed]attribute to this element
Release
Release scroll X or Y
ScrollLeash.releaseX();
ScrollLeash.releaseY();isScrollable
Checks isScrollbar and isScrollAvailable
const isScrollable = Leash.isScrollable(document.documentElement); // trueisScrollBar
Checks scrollBar existence;
const isScrollBar = Leash.isScrollBar(document.documentElement); // trueisScrollAvailable
Checks if container can be scrolled
const isScrollAvailable = Leash.isScrollAvailable(document.documentElement); // trueLicense
This project is available under the MIT license.