Add back to top button

This commit is contained in:
2021-11-22 20:49:11 -06:00
parent 0e1559f2a2
commit 161c68d16c
4 changed files with 41 additions and 3 deletions

8
assets/js/back-to-top.js Normal file
View File

@ -0,0 +1,8 @@
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";
}
}