mirror of
https://github.com/Vimux/Binario.git
synced 2024-11-23 22:48:35 +00:00
15 lines
412 B
JavaScript
15 lines
412 B
JavaScript
const toggle = document.getElementById('toggle');
|
|
const menu = document.getElementById('menu');
|
|
|
|
function toggleMenu() {
|
|
menu.classList.toggle('main-nav__list--active');
|
|
this.classList.toggle('main-nav__btn--active');
|
|
this.setAttribute(
|
|
'aria-expanded',
|
|
this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true',
|
|
);
|
|
}
|
|
|
|
if (toggle && menu) {
|
|
toggle.addEventListener('click', toggleMenu, false);
|
|
}
|