forked from 0x2620/oxjs
some redesign for better garbage collection of elements
This commit is contained in:
parent
01f02d9730
commit
1d09d19423
17 changed files with 129 additions and 101 deletions
|
|
@ -72,12 +72,9 @@ Ox.Button = function(options, self) {
|
|||
setTitle(self.titles[self.selectedTitle].title);
|
||||
|
||||
if (self.options.tooltip) {
|
||||
self.tooltips = Ox.isArray(self.options.tooltip) ? self.options.tooltip : [self.options.tooltip];
|
||||
self.$tooltip = Ox.Tooltip({
|
||||
title: self.tooltips[self.selectedTitle]
|
||||
});
|
||||
that.mouseenter(mouseenter)
|
||||
.mouseleave(mouseleave);
|
||||
self.tooltips = Ox.isArray(self.options.tooltip)
|
||||
? self.options.tooltip : [self.options.tooltip];
|
||||
that.options({tooltip: self.tooltips[self.selectedTitle]});
|
||||
}
|
||||
|
||||
function click() {
|
||||
|
|
@ -108,14 +105,6 @@ Ox.Button = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
function mouseenter(e) {
|
||||
self.$tooltip.show(e.clientX, e.clientY);
|
||||
}
|
||||
|
||||
function mouseleave() {
|
||||
self.$tooltip.hide();
|
||||
}
|
||||
|
||||
function setTitle(title) {
|
||||
self.title = title;
|
||||
if (self.options.type == 'image') {
|
||||
|
|
@ -138,6 +127,8 @@ Ox.Button = function(options, self) {
|
|||
that.toggleClass('OxSelected');
|
||||
}
|
||||
that.triggerEvent('change');
|
||||
} else if (key == 'tooltip') {
|
||||
|
||||
} else if (key == 'title') {
|
||||
setTitle(value);
|
||||
} else if (key == 'width') {
|
||||
|
|
@ -145,7 +136,7 @@ Ox.Button = function(options, self) {
|
|||
width: (value - 14) + 'px'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
toggleDisabled <f>
|
||||
|
|
@ -180,7 +171,7 @@ Ox.Button = function(options, self) {
|
|||
setTitle(self.titles[self.selectedTitle].title);
|
||||
// fixme: if the tooltip is visible
|
||||
// we also need to call show()
|
||||
self.$tooltip && self.$tooltip.options({
|
||||
that.$tooltip && that.$tooltip.options({
|
||||
title: self.tooltips[self.selectedTitle]
|
||||
});
|
||||
return that;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue