mirror of
https://github.com/Fluffy-Bean/Fluffys-website.git
synced 2024-12-28 18:26:05 +00:00
12 lines
308 B
JavaScript
12 lines
308 B
JavaScript
const scroll = document.querySelector('.scroll');
|
|
|
|
function setScroll() {
|
|
let scrollPercentage = (window.scrollY / (document.body.scrollHeight - window.innerHeight)) * 100;
|
|
scroll.style.width = scrollPercentage + '%';
|
|
}
|
|
|
|
if (scroll) {
|
|
setScroll();
|
|
window.onscroll = () => { setScroll(); };
|
|
}
|