only show/hide menu when not shown/hidden (so that events are not bound/unbound twice)

This commit is contained in:
Rolux 2010-07-02 15:06:13 +02:00
parent 3b7b3d8e64
commit 8fb9319192
3 changed files with 14 additions and 5 deletions

View file

@ -5,8 +5,10 @@ body.OxThemeModern {
color: rgb(240, 240, 240); color: rgb(240, 240, 240);
} }
.OxThemeModern .OxHighlight { .OxThemeModern .OxHighlight {
background: rgb(255, 255, 0); //background: rgb(255, 255, 0);
color: rgb(0, 0, 0); //font-weight: bold;
//color: rgb(0, 0, 0);
color: rgb(255, 255, 0);
} }
/* /*

View file

@ -1999,6 +1999,7 @@ requires
} }
function onClick(event, data) { function onClick(event, data) {
Ox.print("onClick", data);
that.$input.focus().val(Ox.stripTags(data.title)); that.$input.focus().val(Ox.stripTags(data.title));
self.autocompleteMenu.hideMenu(); self.autocompleteMenu.hideMenu();
submit(); submit();
@ -3821,6 +3822,9 @@ requires
}; };
that.hideMenu = function() { that.hideMenu = function() {
if (that.is(":hidden")) {
return;
}
$.each(that.submenus, function(i, submenu) { $.each(that.submenus, function(i, submenu) {
if (submenu.is(":visible")) { if (submenu.is(":visible")) {
submenu.hideMenu(); submenu.hideMenu();
@ -3861,6 +3865,9 @@ requires
}; };
that.showMenu = function() { that.showMenu = function() {
if (!that.is(":hidden")) {
return;
}
if (!self.options.parent && !that.$layer.parent().length) { if (!self.options.parent && !that.$layer.parent().length) {
that.$layer.appendTo($body); that.$layer.appendTo($body);
} }

View file

@ -290,7 +290,7 @@ $(function() {
} }
}, },
clear: true, clear: true,
highlight: false, highlight: true,
id: "find", id: "find",
label: [ label: [
{ id: "all", title: "Find: All" }, { id: "all", title: "Find: All" },
@ -369,8 +369,8 @@ $(function() {
], ],
menus: [ menus: [
{ {
id: "demo", id: "oxdb",
title: "Demo", title: "OxDB",
items: [ items: [
{ id: "about", title: "About" } { id: "about", title: "About" }
] ]