fipamo/public/assets/scripts/dash/app/ui/Menu.js

29 lines
668 B
JavaScript
Raw Normal View History

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';
}
}
}