binario/static/js/menu.js

14 lines
386 B
JavaScript
Raw Permalink Normal View History

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',
this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true'
2018-10-30 11:25:25 +00:00
);
2018-11-01 17:27:37 +00:00
}
toggle.addEventListener('click', toggleMenu, false);