PDA

View Full Version : Menu nested in another menu



joza98
13 Jun 2014, 9:31 AM
I have a button with a menu, and in that menu there is another button with a menu. The problem is, when the nested menu is opened, the original menu automatically gets closed. Here is a JSFiddle demonstrating the issue: http://jsfiddle.net/qc8bq/1/

Is there a way to keep both menus open?

Gary Schlosberg
13 Jun 2014, 10:19 AM
Perhaps you could use the beforehide event on the outer menu. If you return false, it should stay open, but you'll need to handle hiding it later when appropriate.

joza98
13 Jun 2014, 12:20 PM
Thanks. Got it working with the following listeners in the outer menu:



mouseenter: function (menu) {
menu.hideMenu = false;
},
mouseleave: function (menu) {
menu.hideMenu = true;
},
beforehide: function (menu) {
if (!menu.hideMenu) {
return false;
}
}