WIP: feat/PausePlayButton closes #16, #30 #34

Draft
adrian wants to merge 16 commits from adrian/site:feat/PausePlayButton into feat/a11y
Showing only changes of commit efeeba4743 - Show all commits

View file

@ -116,3 +116,23 @@ function toggleAnimation() {
}
}
let lastScrollTop = 0; // Last position of the scroll
window.addEventListener("scroll", function() {
let currentPosition = window.pageYOffset || document.documentElement.scrollTop;
const toggleButton = document.querySelectorAll('.toggleButton');
if (currentPosition > lastScrollTop) {
// Scroll down
toggleButton.forEach(button => {
button.style.display = "none";
});
} else {
// Scroll up
toggleButton.forEach(button => {
button.style.display = "block";
});
}
lastScrollTop = currentPosition <= 0 ? 0 : currentPosition; // For Mobile or negative scrolling
}, false);