diff options
author | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-07-17 17:33:12 -0500 |
---|---|---|
committer | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-07-18 13:37:43 -0500 |
commit | cb83c50d4663532b5b1729b27301d22102c17524 (patch) | |
tree | 7e13b20323c6317a90851df737b21035003bdcf6 /app/assets/javascripts/new_sidebar.js | |
parent | fe0c3b79d92348f54c61b81635be65f895d2f712 (diff) | |
download | gitlab-ce-cb83c50d4663532b5b1729b27301d22102c17524.tar.gz |
Add mobile navigation on project page
Diffstat (limited to 'app/assets/javascripts/new_sidebar.js')
-rw-r--r-- | app/assets/javascripts/new_sidebar.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/assets/javascripts/new_sidebar.js b/app/assets/javascripts/new_sidebar.js new file mode 100644 index 00000000000..4aadeb6b462 --- /dev/null +++ b/app/assets/javascripts/new_sidebar.js @@ -0,0 +1,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); + } +} |