mirror of
https://github.com/Vimux/Binario.git
synced 2024-11-11 01:38:28 +00:00
Refactoring menu.js
This commit is contained in:
parent
d6332eff74
commit
d0d945b784
1 changed files with 6 additions and 9 deletions
|
@ -2,13 +2,10 @@ var toggle = document.getElementById('toggle');
|
||||||
var menu = document.getElementById('menu');
|
var menu = document.getElementById('menu');
|
||||||
|
|
||||||
toggle.addEventListener('click', function () {
|
toggle.addEventListener('click', function () {
|
||||||
if (menu.classList.contains('main-nav__list--active')) {
|
menu.classList.toggle('main-nav__list--active');
|
||||||
this.setAttribute('aria-expanded', 'false');
|
this.classList.toggle('main-nav__btn--active');
|
||||||
this.classList.remove('main-nav__btn--active');
|
this.setAttribute(
|
||||||
menu.classList.remove('main-nav__list--active');
|
'aria-expanded',
|
||||||
} else {
|
this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true'
|
||||||
menu.classList.add('main-nav__list--active');
|
);
|
||||||
this.classList.add('main-nav__btn--active');
|
|
||||||
this.setAttribute('aria-expanded', 'true');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue