ScrollTo function
This commit is contained in:
parent
39673d1c12
commit
a66afce9f4
1 changed files with 10 additions and 1 deletions
|
|
@ -1,5 +1,10 @@
|
|||
function ScrollTo() {
|
||||
function ScrollTo(element) {
|
||||
|
||||
/* Scroll to the element top */
|
||||
element.ScrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth"
|
||||
});
|
||||
}
|
||||
|
||||
function ShowElement(element) {
|
||||
|
|
@ -37,3 +42,7 @@ document.addEventListener("scroll", () => {
|
|||
/* How far the user has to scroll to show the element */
|
||||
0.50);
|
||||
});
|
||||
|
||||
document.querySelector(".scroll-up-button").addEventListener("click", () => {
|
||||
ScrollTo(document.documentElement);
|
||||
});
|
||||
Loading…
Reference in a new issue