2018-11-01 17:27:37 +00:00
|
|
|
const toggle = document.getElementById('toggle');
|
|
|
|
const menu = document.getElementById('menu');
|
2018-04-01 12:56:28 +00:00
|
|
|
|
2018-11-01 17:27:37 +00:00
|
|
|
function toggleMenu() {
|
2018-10-30 11:25:25 +00:00
|
|
|
menu.classList.toggle('main-nav__list--active');
|
|
|
|
this.classList.toggle('main-nav__btn--active');
|
|
|
|
this.setAttribute(
|
|
|
|
'aria-expanded',
|
2018-11-01 17:27:37 +00:00
|
|
|
this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true',
|
2018-10-30 11:25:25 +00:00
|
|
|
);
|
2018-11-01 17:27:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (toggle && menu) {
|
|
|
|
toggle.addEventListener('click', toggleMenu, false);
|
|
|
|
}
|