const scrollToTopButton = document.getElementById('totop'); const scrollToTopListener = () => { if (window.scrollY > 0) { scrollToTopButton.className = "totop show"; } else { scrollToTopButton.className = "totop hide"; } }; window.addEventListener("scroll", scrollToTopListener);