12 lines
391 B
JavaScript
12 lines
391 B
JavaScript
window.onscroll = function() {
|
|
if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) {
|
|
document.getElementById("scrollToTopButton").style.display = "block";
|
|
} else {
|
|
document.getElementById("scrollToTopButton").style.display = "none";
|
|
}
|
|
};
|
|
|
|
function scrollToTop() {
|
|
document.body.scrollTop = 0;
|
|
document.documentElement.scrollTop = 0;
|
|
} |