TypeScript Page Scrolling Navigation Menu Bar | Scroll Progress

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.

How does it work?

All you need is a navigation menu with links to relevant paragraphs of the text. When initializing an object, you need to specify the pointer and list selectors, as well as the callback function.

Must Read: Animated Sliding Active Menu Item Indicator In jQuery | Navigation Menu

TypeScript Page Scrolling Navigation Menu Bar Details

Post NameScrollspy Scroll Progress
Author Nameeabrega
CategoryMenu Plugins, Progress Bar, Scrolling
Official PageClick Here
Official Websitegithub.com
Publish DateSeptember 2, 2020
Last UpdateAugust 24, 2023
DownloadLink Below
LicenseMIT

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 the 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');
      }
  );
});

There are two types of events, onScrolled and onChanged. They can be used together or separately.

This small plugin is designed to interactively show the scrolling progress of a page. There are two actions: onScrolled and onChanged. They can be used together or separately.

  • onScrolled – returns the progression for each scroll event. It is convenient to use when you need to view progress in real-time.
  • onChanged – works only when replacing one paragraph with another. This is useful for toggling the active menu item in the navigation block.

See Demo And Download

Page-Scrolling-Navigation-Menu-Bar

Official Website(eabrega): Click Here

This superior jQuery/javascript plugin is developed by eabrega. For extra Advanced usage, please go to the official website.

Related Posts

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Leave a Reply

Your email address will not be published. Required fields are marked *