Track How Far You Are Scrolling – Scrolld

Category: Javascript | August 28, 2019
Author:hallojoe
Views Total:194 views
Official Page:Go to website
Last Update:August 28, 2019
License:MIT

Preview:

Track How Far You Are Scrolling – Scrolld

Description:

Yet another scroll position detection library which tracks how far a web page has been scrolled.

You can use the library to create a scroll position indicator that indicates the scrolling/reading progress as the user scrolls down the web page.

How to use it:

Install & Download the Scolld.

# NPM
$ npm install scrolld --save

Import the scrolld.min.js into the document.

<script src="scrolld.min.js"></script>

Or from the CDN.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/scrolld.min.js"></script>

Initialize the scrolld library and done.

var scrolld = new Scrolld();

You might need to track the scroll position in a specific container. E.g. article.

var scrolld = new Scrolld(document.querySelector('#article'));

Get the current scroll position.

scrolld.percent();

 

You Might Be Interested In:


Leave a Reply