You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
684 B
JavaScript
29 lines
684 B
JavaScript
export default class Menu {
|
|
//--------------------------
|
|
// constructor
|
|
//--------------------------
|
|
constructor() {
|
|
this.mobile = false;
|
|
this.mobileMenu = document.querySelector('[role="mobile-menu"]');
|
|
document
|
|
.querySelector('[role="menu-toggle"]')
|
|
.addEventListener('click', e => this.handleMobile(e));
|
|
}
|
|
//--------------------------
|
|
// methods
|
|
//--------------------------
|
|
start() {}
|
|
//--------------------------
|
|
// event handlers
|
|
//--------------------------
|
|
handleMobile(e) {
|
|
if (this.mobile) {
|
|
this.mobile = false;
|
|
this.mobileMenu.style.display = 'none';
|
|
} else {
|
|
this.mobile = true;
|
|
this.mobileMenu.style.display = 'inline';
|
|
}
|
|
}
|
|
}
|