Fix menu.js for ESLint

This commit is contained in:
vimux 2018-11-01 13:27:37 -04:00
parent 549f6ada87
commit 39e9d944a6
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34

View file

@ -1,11 +1,15 @@
var toggle = document.getElementById('toggle'); const toggle = document.getElementById('toggle');
var menu = document.getElementById('menu'); const menu = document.getElementById('menu');
toggle.addEventListener('click', function () { function toggleMenu() {
menu.classList.toggle('main-nav__list--active'); menu.classList.toggle('main-nav__list--active');
this.classList.toggle('main-nav__btn--active'); this.classList.toggle('main-nav__btn--active');
this.setAttribute( this.setAttribute(
'aria-expanded', 'aria-expanded',
this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true' this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true',
); );
}); }
if (toggle && menu) {
toggle.addEventListener('click', toggleMenu, false);
}