Track How Far You Are Scrolling – Scrolld

Category: Javascript | August 28, 2019
Authorhallojoe
Last UpdateAugust 28, 2019
LicenseMIT
Views225 views
Track How Far You Are Scrolling – Scrolld

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/scrolld@latest/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