Sha256: ff00a219a416f499e8424b766e5f2cb76c74d1e6c7be67b3f51f2266e3ce905e
Contents?: true
Size: 727 Bytes
Versions: 9
Compression:
Stored size: 727 Bytes
Contents
document.addEventListener('DOMContentLoaded', (event) => { let mybutton = document.getElementById("backToTopBtn"); function topFunction() { document.body.scrollTop = 0; // For Safari document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera mybutton.style.opacity = "75%"; } if (mybutton) { mybutton.onclick = topFunction; } // When the user scrolls down 20px from the top of the document, show the button window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { mybutton.style.display = "block"; } else { mybutton.style.display = "none"; } } });
Version data entries
9 entries across 9 versions & 1 rubygems