feat: build website
This commit is contained in:
12
static/js/scrollProgressBar.js
Normal file
12
static/js/scrollProgressBar.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function getScrollPercent() {
|
||||
const totalHeight = document.body.scrollHeight - window.innerHeight;
|
||||
const scrolled = window.scrollY;
|
||||
return (scrolled / totalHeight) * 100;
|
||||
}
|
||||
const scrollProgressBar = document.getElementById("scroll-progress-bar");
|
||||
|
||||
document.onscroll = function () {
|
||||
var scrollPercent = Math.round(getScrollPercent());
|
||||
scrollProgressBar.style.width = scrollPercent + "%";
|
||||
scrollProgressBar.ariaValueNow = scrollPercent;
|
||||
};
|
||||
Reference in New Issue
Block a user