diff options
author | Julius Haertl <jus@bitgrid.net> | 2017-03-03 02:09:49 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-03-16 11:55:10 +0100 |
commit | f58f8f6f475424f08180be15ca00e8ee3778247a (patch) | |
tree | b0f5b97f17234900c1cfb20b1c9233c51b3650fe /core/js/js.js | |
parent | 267b89f5c7a1052645b627c4add167d2bd511813 (diff) | |
download | nextcloud-server-f58f8f6f475424f08180be15ca00e8ee3778247a.tar.gz nextcloud-server-f58f8f6f475424f08180be15ca00e8ee3778247a.zip |
Fix popover positioning after window resize
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'core/js/js.js')
-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(); } }); } |