www_zola_template/static/js/main.js
2025-03-18 16:37:12 +02:00

24 lines
753 B
JavaScript

// Mobile menu toggle
document.addEventListener('DOMContentLoaded', function() {
const menuButton = document.querySelector('[aria-controls="mobile-menu"]');
const mobileMenu = document.getElementById('mobile-menu');
const menuIcons = menuButton.querySelectorAll('svg');
if (menuButton && mobileMenu) {
menuButton.addEventListener('click', function() {
const expanded = menuButton.getAttribute('aria-expanded') === 'true';
// Toggle aria-expanded
menuButton.setAttribute('aria-expanded', !expanded);
// Toggle menu visibility
mobileMenu.classList.toggle('hidden');
// Toggle icons
menuIcons.forEach(icon => {
icon.classList.toggle('hidden');
});
});
}
});