From 56560e3a0333dc5e3f1986c79f6c870b18fcb0d2 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Fri, 29 Jul 2022 01:59:55 +0200 Subject: [PATCH] make the progress bar disappear near the bottom --- assets/js/papermod.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/js/papermod.js b/assets/js/papermod.js index 13437a82..f25f1e46 100644 --- a/assets/js/papermod.js +++ b/assets/js/papermod.js @@ -116,8 +116,9 @@ function progressBar() { var bar = document.getElementById("progressBar"); document.addEventListener('scroll', () => { - var scrollPercent = document.documentElement.scrollTop / (document.documentElement.scrollHeight - window.innerHeight) * 100 + '%'; - bar.style.setProperty("--scrollAmount", scrollPercent); + var scrollPercent = document.documentElement.scrollTop / (document.documentElement.scrollHeight - window.innerHeight) * 100; + if (scrollPercent >= 99) { scrollPercent = 0 }; + bar.style.setProperty("--scrollAmount", scrollPercent + '%'); }) }