mobile optimisation

This commit is contained in:
2026-03-20 12:44:48 +01:00
parent 1af6ae3854
commit 8e034f30ef
5 changed files with 193 additions and 50 deletions

View File

@@ -6,7 +6,51 @@
*/
document.addEventListener("DOMContentLoaded", function() {
// ==========================================
// MOBILE HAMBURGER MENU
// ==========================================
function initHamburgerMenu() {
const hamburgerBtn = document.getElementById('hamburgerBtn');
const mobileNavOverlay = document.getElementById('mobileNavOverlay');
if (!hamburgerBtn || !mobileNavOverlay) return;
function openNav() {
mobileNavOverlay.style.display = 'flex';
requestAnimationFrame(() => {
mobileNavOverlay.classList.add('open');
});
hamburgerBtn.classList.add('open');
document.body.style.overflow = 'hidden';
}
function closeNav() {
mobileNavOverlay.classList.remove('open');
hamburgerBtn.classList.remove('open');
document.body.style.overflow = '';
setTimeout(() => {
if (!mobileNavOverlay.classList.contains('open')) {
mobileNavOverlay.style.display = 'none';
}
}, 300);
}
hamburgerBtn.addEventListener('click', () => {
if (mobileNavOverlay.classList.contains('open')) {
closeNav();
} else {
openNav();
}
});
mobileNavOverlay.querySelectorAll('.mobile-nav-link').forEach(link => {
link.addEventListener('click', closeNav);
});
}
initHamburgerMenu();
// ==========================================
// SOUND VISUALIZATION ANIMATION
// ==========================================