const backToTop = document.getElementById("back-to-top"); window.onscroll = function() { if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { backToTop.style.display = "block"; } else { backToTop.style.display = "none"; } }