Skip to content
Permalink
Browse files

Menubar: Close menu on input click when already open

  • Loading branch information...
jzaefferer committed Feb 28, 2011
1 parent f76e749 commit 58b730f7c7a2fa848eeab12c5b26736a102ed1a4
Showing with 7 additions and 4 deletions.
  1. +7 −4 tests/visual/menu/menubar.js
@@ -49,13 +49,16 @@ $.widget("ui.menubar", {
var input = $(this),
menu = input.next("ul");

input
.bind("click focus mouseenter", function(event) {
input.bind("click focus mouseenter", function(event) {
event.preventDefault();
event.stopPropagation();
if (menu.is(":visible") && self.active && self.active[0] == menu[0]) {
self._close();
return;
}
if (menu.length && (!/^mouse/.test(event.type) || self.active && self.active.is(":visible") )) {
self._open(event, menu);
}
event.preventDefault();
event.stopPropagation();
})
.addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")
.wrapInner("<span class='ui-button-text'></span>");

0 comments on commit 58b730f

Please sign in to comment.
You can’t perform that action at this time.