fix for MenuButton and Select double button toggle

This commit is contained in:
rolux 2012-12-29 02:18:50 +01:00
parent 66a041ef30
commit a9c026f6db
2 changed files with 10 additions and 6 deletions

View file

@ -90,7 +90,9 @@ Ox.Select = function(options, self) {
width: self.options.width - 2 + 'px'
})
.bindEvent({
anyclick: showMenu,
anyclick: function(e) {
showMenu($(e.target).is('.OxButton') ? 'button' : null);
},
key_escape: loseFocus,
key_down: showMenu
});
@ -214,10 +216,10 @@ Ox.Select = function(options, self) {
}
function showMenu() {
function showMenu(from) {
that.gainFocus();
that.addClass('OxSelected');
self.$button.options({value: true});
from != 'button' && self.$button.options({value: true});
self.options.tooltip && that.$tooltip.hide();
self.$menu.showMenu();
}

View file

@ -60,7 +60,9 @@ Ox.MenuButton = function(options, self) {
width: self.options.width - 2 + 'px'
})
.bindEvent({
anyclick: showMenu
anyclick: function(e) {
showMenu($(e.target).is('.OxButton') ? 'button' : null);
},
});
if (self.options.type == 'text') {
@ -112,10 +114,10 @@ Ox.MenuButton = function(options, self) {
that.triggerEvent('hide');
}
function showMenu() {
function showMenu(from) {
that.gainFocus();
that.addClass('OxSelected');
self.$button.options({value: true});
from != 'button' && self.$button.options({value: true});
self.options.tooltip && that.$tooltip.hide();
self.$menu.showMenu();
that.triggerEvent('show');