diff options
Diffstat (limited to 'phpBB/adm/style/admin.js')
-rw-r--r-- | phpBB/adm/style/admin.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 208afedce8..a9e00ab9d7 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -15,11 +15,27 @@ function parse_document(container) /** * Navigation */ - container.find('#menu .menu-block > a.header').click(function() { - $(this).parent().toggleClass('active'); - }); + container.find('#menu').each(function() { + var menu = $(this), + blocks = menu.children('.menu-block'); + + if (!blocks.length) { + return; + } + + // Set onclick event + blocks.children('a.header').click(function() { + $(this).parent().toggleClass('active'); + }); + + // Set active menu + menu.find('#activemenu').parents('.menu-block').addClass('active'); - container.find('#activemenu').parents('.menu-block').addClass('active'); + // Check if there is active menu + if (!blocks.filter('.active').length) { + blocks.filter(':first').addClass('active'); + } + }); } /** |