ldc-doux/resources/js/app.js
Sebastien Hattry a7be310a34 integration
2021-11-18 14:36:06 +01:00

33 lines
815 B
JavaScript
Vendored

var app = {
init: () => {
window.onscroll = function () {
app.scrollFunction();
};
app.scroll();
},
scroll: () => {
document
.getElementById("backtotop")
.addEventListener("click", function () {
window.scrollTo({
top: 0,
behavior: "smooth",
});
});
},
scrollFunction: () => {
if (
document.body.scrollTop > 100 ||
document.documentElement.scrollTop > 100
) {
document.getElementById("backtotop").style.display = "flex";
} else {
document.getElementById("backtotop").style.display = "none";
}
},
};
document.addEventListener("DOMContentLoaded", app.init);