Fix menu.js for ESLint
This commit is contained in:
parent
549f6ada87
commit
39e9d944a6
1 changed files with 9 additions and 5 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue