--- a/src/js/widgets/tooltipWidget.js Mon Mar 05 10:55:08 2012 +0100
+++ b/src/js/widgets/tooltipWidget.js Mon Mar 05 17:34:48 2012 +0100
@@ -4,6 +4,7 @@
this._shown = false;
this._displayedText = "";
this._hideTimeout = -1;
+ console.log(config.container);
};
@@ -11,8 +12,15 @@
IriSP.TooltipWidget.prototype.draw = function() {
var templ = Mustache.to_html(IriSP.tooltipWidget_template);
- // position the widget absolutely relative to document.
- this.selector.css("position", "static");
+ // position the widget absolutely relative to document. --- NOOOO !!!!
+ this.selector.css({
+ "position": "absolute",
+ "top": 0,
+ "left": 0
+ });
+ this.selector.parent().css({
+ "position": "relative"
+ });
this.selector.append(templ);
this.hide();
@@ -29,15 +37,14 @@
this.selector.find(".tipcolor").css("background-color", color);
this._displayedText = text;
- this.selector.find(".tiptext").html(text);
+ this.selector.find(".tiptext").html(text);
- if (x < 0)
- x = 0;
- if (y < 0)
- y = 0;
-
- this.selector.find(".tip").css("left", x).css("top", y);
- this.selector.find(".tip").show();
+ var _tip = this.selector.find(".tip");
+ _tip.show();
+ _tip.css({
+ "left": Math.floor(x - _tip.outerWidth() / 2)+"px",
+ "top": Math.floor(y - _tip.outerHeight())+"px"
+ });
this._shown = true;
};