Scroll progress is a free library on TypeScript for syncing page scrolling and menu navigation. This tiny plugin is intended to interactively display scrolling page progress.
There are two types of events, onScrolled and onChanged. They can be used together or separately.
[Off-Canvas] Simple and Clean Side Navigation Menu With Dropdowns | jSide Menu
How to make use of it:
1. Create nav links pointing to the sections.
<nav id="home"> <div id="cursor"></div> <menu> <a href="#link1">Paragraph A</a> <a href="#link2">Paragraph B</a> <a href="#link3">Paragraph C</a> </menu> </nav>
<h1 id="link1">Paragraph A</h1> <h1 id="link2">Paragraph B</h1> <h1 id="link3">Paragraph C</h1>
2. Create a container to hold scroll position information.
<status> <span id="current-paragraph-name"></span> <span id="current-paragraph-percent"></span> </status>
3. Load the Scroll Progress library on the web page.
<script src="scroll-progress.min.js"></script>
4. Enable the scrollspy functionality and scroll progress indicator.
document.addEventListener("DOMContentLoaded", function (event) { let currentParagraphName = document.getElementById('current-paragraph-name'); let currentParagraphPercent = document.getElementById('current-paragraph-percent'); new ScrollProgress.Init( "#cursor", "menu", progress => { currentParagraphName.innerText = document.getElementById(progress.id).innerText; currentParagraphPercent.innerText = progress.percent + '%'; }, id => { document.querySelectorAll('a[href*="link"]').forEach(element => element.classList.remove('active-meny-item')); document.querySelector(`[href="#${id}"]`).classList.add('active-meny-item'); } ); });
Tiny ScrollSpy & Scroll Progress Indicator, scroll-progress GitHub, vertical scroll progress bar, Scroll Progress Bar Plugin
See Demo And Download
Official Website(eabrega): Click Here
This superior jQuery/javascript plugin is developed by eabrega. For extra Advanced Usages, please go to the official website.
Be First to Comment