Ox.Tooltip: use html() or append(); test for arguments.length, not object; factor out setTitle; missing semicolon
This commit is contained in:
parent
7f83cd9495
commit
930f9ab4e7
1 changed files with 17 additions and 7 deletions
|
@ -18,16 +18,26 @@ Ox.Tooltip = function(options, self) {
|
|||
.options(options || {})
|
||||
.update({
|
||||
title: function() {
|
||||
that.html(self.options.title);
|
||||
setTitle();
|
||||
self.options.title === '' && that.detach();
|
||||
}
|
||||
})
|
||||
.addClass('OxTooltip')
|
||||
.html(self.options.title);
|
||||
[Ox.isString(self.options.title) ? 'html' : 'append'](
|
||||
self.options.title
|
||||
);
|
||||
|
||||
self.options.animate && that.css({
|
||||
opacity: 0
|
||||
});
|
||||
self.options.animate && that.css({opacity: 0});
|
||||
|
||||
setTitle();
|
||||
|
||||
function setTitle() {
|
||||
if (Ox.isString(self.options.title)) {
|
||||
that.html(self.options.title);
|
||||
} else {
|
||||
that.empty().append(self.options.title);
|
||||
}
|
||||
}
|
||||
|
||||
/*@
|
||||
hide <f> hide tooltip
|
||||
|
@ -61,12 +71,12 @@ Ox.Tooltip = function(options, self) {
|
|||
var last = Ox.last(arguments),
|
||||
left, top, width, height;
|
||||
if (self.options.title) {
|
||||
if (Ox.isObject(arguments[0])) {
|
||||
if (arguments.length == 1) {
|
||||
self.x = arguments[0].clientX;
|
||||
self.y = arguments[0].clientY;
|
||||
} else {
|
||||
self.x = x;
|
||||
self.y = y
|
||||
self.y = y;
|
||||
}
|
||||
$('.OxTooltip').detach(); // fixme: don't use DOM
|
||||
that.appendTo(Ox.UI.$body);
|
||||
|
|
Loading…
Reference in a new issue