forked from projects/fipamo
29 lines
668 B
JavaScript
29 lines
668 B
JavaScript
|
export default class Menu {
|
||
|
//--------------------------
|
||
|
// constructor
|
||
|
//--------------------------
|
||
|
constructor() {
|
||
|
this.mobile = false;
|
||
|
this.mobileMenu = document.querySelector('.mobile-menu');
|
||
|
document
|
||
|
.querySelector('.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';
|
||
|
}
|
||
|
}
|
||
|
}
|