2017-07-17 18:33:12 -04:00
|
|
|
export default class NewNavSidebar {
|
|
|
|
constructor() {
|
|
|
|
this.initDomElements();
|
|
|
|
}
|
|
|
|
|
|
|
|
initDomElements() {
|
|
|
|
this.$sidebar = $('.nav-sidebar');
|
2017-07-18 12:40:42 -04:00
|
|
|
this.$overlay = $('.mobile-overlay');
|
2017-07-17 18:33:12 -04:00
|
|
|
this.$openSidebar = $('.toggle-mobile-nav');
|
|
|
|
this.$closeSidebar = $('.close-nav-button');
|
|
|
|
}
|
|
|
|
|
|
|
|
bindEvents() {
|
2017-07-19 21:26:18 -04:00
|
|
|
this.$openSidebar.on('click', () => this.toggleSidebarNav(true));
|
|
|
|
this.$closeSidebar.on('click', () => this.toggleSidebarNav(false));
|
|
|
|
this.$overlay.on('click', () => this.toggleSidebarNav(false));
|
2017-07-17 18:33:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
toggleSidebarNav(show) {
|
2017-07-18 12:40:42 -04:00
|
|
|
this.$sidebar.toggleClass('nav-sidebar-expanded', show);
|
|
|
|
this.$overlay.toggleClass('mobile-nav-open', show);
|
2017-07-17 18:33:12 -04:00
|
|
|
}
|
|
|
|
}
|