="scrollToTopBtn" title="Go to top"></button>
<script>
// Show or hide Scrolltotop button
function ToggleScrollToTop() {
if (document.body.scrollTop > 1000 || document.documentElement.scrollTop > 1000) {
document.getElementById("scrollToTopBtn").style.display = "block";
} else {
document.getElementById("scrollToTopBtn").style.display = "none";
}
}
// Check every defined value millisecond
setInterval( ToggleScrollToTop, 250 );
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
</script> |