ScrollTo function

This commit is contained in:
ReznoRMichael 2021-02-16 19:21:16 +01:00
parent 39673d1c12
commit a66afce9f4

View file

@ -1,5 +1,10 @@
function ScrollTo() { function ScrollTo(element) {
/* Scroll to the element top */
element.ScrollTo({
top: 0,
behavior: "smooth"
});
} }
function ShowElement(element) { function ShowElement(element) {
@ -37,3 +42,7 @@ document.addEventListener("scroll", () => {
/* How far the user has to scroll to show the element */ /* How far the user has to scroll to show the element */
0.50); 0.50);
}); });
document.querySelector(".scroll-up-button").addEventListener("click", () => {
ScrollTo(document.documentElement);
});