Tweak the scroll button

This commit is contained in:
Tom Hubrecht 2021-08-20 12:48:39 +02:00
parent b4ffd2ee36
commit d210fc88c4
4 changed files with 8 additions and 2 deletions

View file

@ -10590,6 +10590,7 @@ body {
position: fixed; position: fixed;
bottom: 2em; bottom: 2em;
right: 2em; right: 2em;
z-index: 30;
} }
/*# sourceMappingURL=main.css.map */ /*# sourceMappingURL=main.css.map */

File diff suppressed because one or more lines are too long

View file

@ -51,3 +51,4 @@ body
position: fixed position: fixed
bottom: 2em bottom: 2em
right: 2em right: 2em
z-index: 30

View file

@ -106,8 +106,12 @@
// Scroll to top button // Scroll to top button
$up_btn = document.getElementById('scroll-button'); $up_btn = document.getElementById('scroll-button');
if (document.documentElement.scrollTop >= 100) {
$up_btn.classList.remove('is-hidden');
}
window.onscroll = () => { window.onscroll = () => {
if (document.documentElement.scrollTop >= 30) { if (document.documentElement.scrollTop >= 100) {
$up_btn.classList.remove('is-hidden'); $up_btn.classList.remove('is-hidden');
} else { } else {
$up_btn.classList.add('is-hidden'); $up_btn.classList.add('is-hidden');