bobatheme/assets/js/back-to-top.js

9 lines
280 B
JavaScript
Raw Permalink Normal View History

2021-11-22 20:49:11 -06:00
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";
}
}