Make buttons more consistent

Rename JumpUp button to top-of-page
This commit is contained in:
Michał Gdula 2023-03-12 18:19:43 +00:00
parent 0d10de923d
commit b208b872d7
13 changed files with 143 additions and 102 deletions

View file

@ -76,12 +76,13 @@ window.onscroll = function () {
loadOnView();
// Jump to top button
let topOfPage = document.querySelector('.top-of-page');
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
document.querySelector('.jumpUp').classList = 'jumpUp jumpUp--show';
topOfPage.classList.add('show');
} else {
document.querySelector('.jumpUp').classList = 'jumpUp';
topOfPage.classList.remove('show');
}
document.querySelector('.jumpUp').onclick = function () {
topOfPage.onclick = function () {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}