24 lines
753 B
JavaScript
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');
|
|
});
|
|
});
|
|
}
|
|
});
|