From 3849733d9a058553627ed73574a749e21081f028 Mon Sep 17 00:00:00 2001 From: SWARAJ DAS <151845349+swaraj-das@users.noreply.github.com> Date: Sun, 13 Oct 2024 07:26:56 +0530 Subject: [PATCH] Update script.js --- script.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/script.js b/script.js index 0fad84b3..d9fe89ef 100644 --- a/script.js +++ b/script.js @@ -15,6 +15,21 @@ function toggleMenu() { } } +window.onscroll = function() { + updateProgressBar(); + }; +function updateProgressBar() { + var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; + var scrollHeight = + document.documentElement.scrollHeight - + document.documentElement.clientHeight; + var scrollPercent = (scrollTop / scrollHeight) * 100; + document.getElementById("progressBar").style.width = scrollPercent + "%"; +} +document.addEventListener("DOMContentLoaded", () => { + console.log("Website loaded successfully!"); +}); + // Show or hide the scroll-top button based on scroll position window.addEventListener('scroll', function() { const scrollTopButton = document.querySelector('.scroll-top');