mirror of
https://github.com/Fluffy-Bean/Fluffys-website.git
synced 2025-01-15 02:35:13 +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(); };
|
||
|
}
|