summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/fly_out_nav.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-08-02 10:22:13 +0100
committerPhil Hughes <me@iamphill.com>2017-08-02 10:22:13 +0100
commit25d6a6c4b528159c288995de4909e6a8da431d0b (patch)
tree691fe780f176b93817c757b3b5658be331bf22b5 /app/assets/javascripts/fly_out_nav.js
parente67c4a6d913ccdb4615639cb317634141da2a37b (diff)
downloadgitlab-ce-25d6a6c4b528159c288995de4909e6a8da431d0b.tar.gz
stop mobile from showing the sub-items
Diffstat (limited to 'app/assets/javascripts/fly_out_nav.js')
-rw-r--r--app/assets/javascripts/fly_out_nav.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/assets/javascripts/fly_out_nav.js b/app/assets/javascripts/fly_out_nav.js
index 3f64c16a79d..8e9a97fe207 100644
--- a/app/assets/javascripts/fly_out_nav.js
+++ b/app/assets/javascripts/fly_out_nav.js
@@ -1,3 +1,8 @@
+/* global bp */
+import './breakpoints';
+
+export const canShowSubItems = () => bp.getBreakpointSize() === 'md' || bp.getBreakpointSize() === 'lg';
+
export const calculateTop = (boundingRect, outerHeight) => {
const windowHeight = window.innerHeight;
const bottomOverflow = windowHeight - (boundingRect.top + outerHeight);
@@ -9,7 +14,7 @@ export const calculateTop = (boundingRect, outerHeight) => {
export const showSubLevelItems = (el) => {
const subItems = el.querySelector('.sidebar-sub-level-items');
- if (!subItems) return;
+ if (!subItems || !canShowSubItems()) return;
subItems.style.display = 'block';
el.classList.add('is-over');
@@ -28,7 +33,7 @@ export const showSubLevelItems = (el) => {
export const hideSubLevelItems = (el) => {
const subItems = el.querySelector('.sidebar-sub-level-items');
- if (!subItems) return;
+ if (!subItems || !canShowSubItems()) return;
el.classList.remove('is-over');
subItems.style.display = 'none';