Fix popover positioning after window resize
Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
parent
267b89f5c7
commit
f58f8f6f47
1 changed files with 13 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue