make the progress bar disappear near the bottom

This commit is contained in:
Wonderfall committed 2022-07-29 01:59:55 +02:00
1 parent 13876beb0a
commit 56560e3a03
1 file changed
+3 -2
+3 -2
View File
@@ -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 + '%');
})
}