gitlab-org--gitlab-foss/app/assets/javascripts/new_sidebar.js

24 lines
675 B
JavaScript
Raw Normal View History

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() {
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
}
}