sss-leash

2.1.5 • Public • Published

Leash

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 --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.

/sss-leash/

    Package Sidebar

    Install

    npm i sss-leash

    Weekly Downloads

    0

    Version

    2.1.5

    License

    MIT

    Unpacked Size

    15.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • natteke