Welcome to mirror list, hosted at ThFree Co, Russian Federation.

new_sidebar.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4aadeb6b4626cc5db1d7764977f86727cf8e4352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const SIDEBAR_EXPANDED_CLASS = 'nav-sidebar-expanded';

export default class NewNavSidebar {
  constructor() {
    this.initDomElements();
    this.bindEvents();
  }

  initDomElements() {
    this.$sidebar = $('.nav-sidebar');
    this.$openSidebar = $('.toggle-mobile-nav');
    this.$closeSidebar = $('.close-nav-button');
  }

  bindEvents() {
    this.$openSidebar.on('click', e => this.toggleSidebarNav(e, true));
    this.$closeSidebar.on('click', e => this.toggleSidebarNav(e, false));
  }

  toggleSidebarNav(show) {
    this.$sidebar.toggleClass(SIDEBAR_EXPANDED_CLASS, show);
  }
}