2024-01-08 16:15:11 +00:00
|
|
|
window.onload = (event) => {
|
|
|
|
if ((document.documentElement.scrollHeight / window.screen.availHeight ) > 1.5) {
|
|
|
|
window.addEventListener("scroll", () => {
|
|
|
|
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
|
|
|
|
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
|
|
|
|
var scrolled = (winScroll / height) * 100;
|
|
|
|
document.getElementById('progress').style.width = scrolled + "%";
|
2024-01-08 09:25:00 +00:00
|
|
|
|
2024-01-08 16:15:11 +00:00
|
|
|
const toTop = document.getElementById('totop');
|
2024-01-08 09:25:00 +00:00
|
|
|
|
2024-01-08 16:15:11 +00:00
|
|
|
if ((window.scrollY > 0 && !toTop.classList.contains("show")) || (window.scrollY <= 0 && toTop.classList.contains("show"))) {
|
|
|
|
toTop.classList.toggle("show");
|
|
|
|
}
|
|
|
|
});
|
2024-01-08 09:25:00 +00:00
|
|
|
}
|
2024-01-08 16:15:11 +00:00
|
|
|
}
|