SAE15_2022/assets/js/script.js

16 lines
426 B
JavaScript
Raw Normal View History

let backToTop = document.getElementById("backToTop");
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
backToTop.style.display = "block";
} else {
backToTop.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}