From 8ba569b1ebfaa79103ff7acff542197b7fa5c522 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 29 Oct 2014 11:00:07 +0100 Subject: [PATCH] Added code to automhide all open menus on other menu click --- src/js/common.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/js/common.js b/src/js/common.js index 40601a2..bcfac70 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -447,9 +447,15 @@ function CreateMenuFunction ( szbuttonobjid, szmenuobjid, bHide ) // Hide menu.hide(); } - + $(szbuttonobjid).button() .click(function() { + + /* Hide all other Menus first!*/ + $('ul[id^="menu"]').each(function () { + $(this).hide(); + }); + // Make use of the general purpose show and position operations // open and place the menu where we want. menu.show().position({ @@ -462,14 +468,14 @@ function CreateMenuFunction ( szbuttonobjid, szmenuobjid, bHide ) // Register a click outside the menu to close it $( document ).on( "click", function() { - menu.hide(); + menu.hide(); }); // Helper function to close a menu by escape key $( document ).keyup(function(e) { if (e.keyCode == 27) { menu.hide(); - } + } }); // Helper function to click a link by keypress @@ -488,8 +494,7 @@ function CreateMenuFunction ( szbuttonobjid, szmenuobjid, bHide ) } }); - // Make sure to return false here or the click registration - // above gets invoked. + // Make sure to return false here or the click registration above gets invoked. return false; }) }