Visualize Scrolling Progress with ScrollProgress.js

Category: Javascript | March 31, 2024
Views Total:19 views
Official Page:Go to website
Last Update:March 31, 2024


Visualize Scrolling Progress with ScrollProgress.js


ScrollProgressJS is a lightweight JavaScript library for creating a customizable scroll progress indicator. It can improve the browsing experience on content-heavy websites and motivate visitors to continue reading by visually tracking their progress.

As the user scrolls, an event listener continually updates the width of the progress bar to reflect the percentage of the page that has been scrolled. This calculation is performed by dividing the current scroll position by the total scrollable height, multiplied by 100 to obtain the percentage value.

How to use it:

1. Download and include the ScrollProgressJS on your webpage. If the data-autoload attribute is set on the script element, the library automatically initializes itself with default options upon page load:

<script src="ScrollProgress.js" data-autoload="true"></script>

2. Or initialize the library manually and pass the options to the ScrollProgress.init() method.

  // fill color
  color: '#ff5722', 
  // height in px
  height: '4px', 
  'top' or 'bottom'
  position: 'top',

3. Update the configuration options dynamically.

  color: 'red',
  height: '5px', 
  position: 'bottom'

4. Destroy the instance and remove the scroll progress indicator from your page.




  • Added ScrollProgress.module.js

You Might Be Interested In:

Leave a Reply