1
0
Fork 0
forked from 0x2620/oxjs

add tooltips to textlist cells

This commit is contained in:
rlx 2011-08-28 19:50:06 +00:00
commit b55ade5687
4 changed files with 57 additions and 37 deletions

View file

@ -32,14 +32,16 @@ Ox.Tooltip = function(options, self) {
};
that.hide = function() {
if (self.options.animate) {
that.animate({
opacity: 0
}, 250, function() {
if (self.options.title) {
if (self.options.animate) {
that.animate({
opacity: 0
}, 250, function() {
that.removeElement();
});
} else {
that.removeElement();
});
} else {
that.removeElement();
}
}
return that;
};
@ -48,23 +50,25 @@ Ox.Tooltip = function(options, self) {
// fixme: use this in widgets
that.show = function(x, y) {
var left, top, width, height;
if (arguments.length == 1) {
y = arguments[0].clientY;
x = arguments[0].clientX;
if (self.options.title) {
if (arguments.length == 1) {
y = arguments[0].clientY;
x = arguments[0].clientX;
}
$('.OxTooltip').remove(); // fixme: don't use DOM
that.appendTo(Ox.UI.$body);
width = that.width();
height = that.height();
left = Ox.limit(x - width / 2, 0, window.innerWidth - width);
top = y > window.innerHeight - height - 16 ? y - 16 - height : y + 16;
that.css({
left: left + 'px',
top: top + 'px'
});
self.options.animate && that.animate({
opacity: 1
}, 250);
}
$('.OxTooltip').remove(); // fixme: don't use DOM
that.appendTo(Ox.UI.$body);
width = that.width();
height = that.height();
left = Ox.limit(x - width / 2, 0, window.innerWidth - width);
top = y > window.innerHeight - height - 16 ? y - 16 - height : y + 16;
that.css({
left: left + 'px',
top: top + 'px'
});
self.options.animate && that.animate({
opacity: 1
}, 250);
return that;
};