sss-leash
v2.1.5
Published
Browser scrollbar helper (Disable/Enable by X, Y) and more...
Downloads
7
Maintainers
Readme
About
Leash is a Browser scrollbar helper (Disable/Enable by X and Y).
Installation
Download Leash
Connect
Leash
before your scripts.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 --save
Do 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:fixed
elements, 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); // true
isScrollBar
Checks scrollBar existence;
const isScrollBar = Leash.isScrollBar(document.documentElement); // true
isScrollAvailable
Checks if container can be scrolled
const isScrollAvailable = Leash.isScrollAvailable(document.documentElement); // true
License
This project is available under the MIT license.