hermit-V2/assets/js/scrollwatcher.js

1 line
363 B
JavaScript
Raw Permalink Normal View History

2023-08-19 03:24:17 -04:00
const scroll=document.querySelector(".scroll-up"),rootElement=document.documentElement;function handleScroll(){rootElement.scrollTop/(rootElement.scrollHeight-rootElement.clientHeight)>.4?(scroll.classList.remove("hide"),scroll.classList.add("show")):(scroll.classList.add("hide"),scroll.classList.remove("show"))}document.addEventListener("scroll",handleScroll);