1
0
Fork 0
forked from 0x2620/oxjs

use new-style mouse events in Ox.List

This commit is contained in:
rlx 2011-09-03 23:04:18 +00:00
commit be3b1d573d
8 changed files with 185 additions and 143 deletions

View file

@ -52,15 +52,22 @@ Ox.Tooltip = function(options, self) {
var left, top, width, height;
if (self.options.title) {
if (arguments.length == 1) {
y = arguments[0].clientY;
x = arguments[0].clientX;
self.x = arguments[0].clientX;
self.y = arguments[0].clientY;
} else if (arguments.length == 2) {
self.x = x;
self.y = y
}
$('.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;
left = Ox.limit(
self.x - width / 2, 0, window.innerWidth - width
);
top = self.y > window.innerHeight - height - 16
? self.y - 16 - height
: self.y + 16;
that.css({
left: left + 'px',
top: top + 'px'