fixed long-standing tooltip positioning bug. popcorn-port
authorhamidouk
Fri, 30 Dec 2011 12:38:53 +0100
branchpopcorn-port
changeset 550 ae0f2ec05ed7
parent 549 8abffd2de54a
child 551 2f883ad196b2
fixed long-standing tooltip positioning bug.
src/css/LdtPlayer.css
src/js/widgets/segmentsWidget.js
src/js/widgets/tooltipWidget.js
--- a/src/css/LdtPlayer.css	Fri Dec 30 11:55:54 2011 +0100
+++ b/src/css/LdtPlayer.css	Fri Dec 30 12:38:53 2011 +0100
@@ -299,10 +299,7 @@
 }
 
 .tip{
-/* why not absolute instead of fixed ? because the div containing the tooltip widget is not a subdiv of its parent
-                       widget */
-  /*position : fixed;  */
-  position:fixed;
+  position: absolute;
   padding : 3px;
   z-index: 10000000000;
   max-width: 200px;
--- a/src/js/widgets/segmentsWidget.js	Fri Dec 30 11:55:54 2011 +0100
+++ b/src/js/widgets/segmentsWidget.js	Fri Dec 30 12:38:53 2011 +0100
@@ -135,8 +135,10 @@
           var offset_x = offset.left + correction - 106;
           if (offset_x < 0)
             offset_x = 0;
-                    
-          self.TooltipWidget.show(divTitle, color, offset_x, event.pageY - 160);
+          
+          var offset_y = offset.top;          
+          console.log(offset_y);
+          self.TooltipWidget.show(divTitle, color, offset_x, offset_y - 160);
     } })(divTitle)).mouseout(function(){
       IriSP.jQuery(this).animate({opacity: 0.3}, 5);
       self.TooltipWidget.hide();
--- a/src/js/widgets/tooltipWidget.js	Fri Dec 30 11:55:54 2011 +0100
+++ b/src/js/widgets/tooltipWidget.js	Fri Dec 30 12:38:53 2011 +0100
@@ -11,7 +11,8 @@
 
 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");
   this.selector.append(templ);
   this.hide();