diff --git a/js/functions.js b/js/functions.js index b104aff7b4..235c245a80 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3612,29 +3612,28 @@ function PMA_createViewDialog($this) * Makes the breadcrumbs and the menu bar float at the top of the viewport */ $(function () { - // Double queue the event to make sure the page is ready - $(function () { - - if ($("#floating_menubar").length && $('#PMA_disable_floating_menubar').length == 0) { - var left = $('html').attr('dir') == 'ltr' ? 'left' : 'right'; - $("#floating_menubar") - .css('margin-' + left, $('#pma_navigation').width() + $('#pma_navigation_resizer').width()) - .css(left, 0) - .css({ - 'position': 'fixed', - 'top': 0, - 'width': '100%', - 'z-index': 500 - }) - .append($('#serverinfo')) - .append($('#topmenucontainer')); + if ($("#floating_menubar").length && $('#PMA_disable_floating_menubar').length == 0) { + var left = $('html').attr('dir') == 'ltr' ? 'left' : 'right'; + $("#floating_menubar") + .css('margin-' + left, $('#pma_navigation').width() + $('#pma_navigation_resizer').width()) + .css(left, 0) + .css({ + 'position': 'fixed', + 'top': 0, + 'width': '100%', + 'z-index': 500 + }) + .append($('#serverinfo')) + .append($('#topmenucontainer')); + // Allow the DOM to render, then adjust the padding on the body + setTimeout(function () { $('body').css( 'padding-top', $('#floating_menubar').outerHeight(true) ); $('#topmenu').menuResizer('resize'); - } - }); + }, 4); + } }); /**