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

Draft
adrian wants to merge 16 commits from adrian/site:feat/PausePlayButton into feat/a11y
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 0c3e79cd94 - Show all commits

View file

@ -7,6 +7,7 @@
--> -->
<html lang="fr"> <html lang="fr">
<head> <head>
<meta name="robots" content="noindex">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'"> <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, height=device-height, minimum-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1, height=device-height, minimum-scale=1.0">

View file

@ -116,10 +116,10 @@ async function setupPage() {
} }
let lastScrollTop = 0; let lastScrollTop = 0;
let isScrolling = false; let isCallbackRegistered = false;
window.addEventListener("scroll", function() { window.addEventListener("scroll", function() {
if (!isScrolling) { if (!isCallbackRegistered) {
window.requestAnimationFrame(function() { window.requestAnimationFrame(function() {
let currentPosition = window.scrollY || document.documentElement.scrollTop; let currentPosition = window.scrollY || document.documentElement.scrollTop;
const toggleButton = document.querySelectorAll('.toggleButton'); const toggleButton = document.querySelectorAll('.toggleButton');
@ -135,12 +135,11 @@ async function setupPage() {
button.style.display = "block"; button.style.display = "block";
}); });
} }
lastScrollTop = currentPosition <= 0 ? 0 : currentPosition; // For Mobile or negative scrolling lastScrollTop = currentPosition <= 0 ? 0 : currentPosition; // For Mobile or negative scrolling
isScrolling = false; isCallbackRegistered = false;
}); });
isScrolling = true; isCallbackRegistered = true;
} }
}); });
} }