diff options
-rw-r--r-- | core/js/js.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/js/js.js b/core/js/js.js index b001eeecdf7..c8907cdfc90 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1370,8 +1370,9 @@ function initCore() { */ function setupMainMenu() { - // init the more-apps menu - OC.registerMenu($('#more-apps'), $('#navigation')); + // init the more-apps menu + OC.registerMenu($('#more-apps'), $('#navigation')); + // toggle the navigation var $toggle = $('#header .header-appname-container'); var $navigation = $('#navigation'); @@ -1441,13 +1442,20 @@ function initCore() { // move triangle of apps dropdown to align with app name triangle // 2 is the additional offset between the triangles if($('#navigation').length) { - $('#header #nextcloud + .menutoggle').one('click', function(){ - var caretPosition = $('#more-apps').offset().left - 2; + $('#header #nextcloud + .menutoggle').on('click', function(){ + $('#menu-css-helper').remove(); + var caretPosition = $('.header-appname + .icon-caret').offset().left - 2; if(caretPosition > 255) { // if the app name is longer than the menu, just put the triangle in the middle return; } else { - $('head').append('<style>#navigation:after { left: '+ caretPosition +'px; }</style>'); + $('head').append('<style id="menu-css-helper">#navigation:after { left: '+ caretPosition +'px; }</style>'); + } + }); + $('#header #appmenu .menutoggle').on('click', function() { + $('#appmenu').toggleClass('menu-open'); + if($('#appmenu').is(':visible')) { + $('#menu-css-helper').remove(); } }); } |