Index: hovertip.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/hovertip/hovertip.js,v retrieving revision 1.2 diff -u -r1.2 hovertip.js --- hovertip.js 20 Feb 2007 15:21:28 -0000 1.2 +++ hovertip.js 8 Aug 2007 03:29:31 -0000 @@ -65,7 +65,7 @@ var mouse = hovertipMouseXY(e); hovertipMouseX = mouse[0]; hovertipMouseY = mouse[1]; -} +}; // http://www.howtocreate.co.uk/tutorials/javascript/eventinfo function hovertipMouseXY(e) { @@ -106,7 +106,7 @@ return; } return [xcoord, ycoord]; -} +}; @@ -159,14 +159,14 @@ sibling = sibling.previousSibling; return $(sibling); -} +}; /** * Make all siblings targets. Experimental. */ targetSelectBySiblings = function(el, config) { return $(el).siblings(); -} +}; //// prepare tip elements //// @@ -197,7 +197,7 @@ // do not modify tooltips when preparing hovertipPrepareNoOp = function(o, config) { return o; -} +}; //// manipulate tip elements ///// /** @@ -208,11 +208,11 @@ // positioned elements. hovertipPosition = function(i) { document.body.appendChild(this); -} +}; hovertipIsVisible = function(el) { return (jQuery.css(el, 'display') != 'none'); -} +}; // show the tooltip under the mouse. // Introduce a delay, so tip appears only if cursor rests on target for more than an instant. @@ -225,7 +225,25 @@ 'position':'absolute', 'top': hovertipMouseY + 'px', 'left': hovertipMouseX + 'px'}) - .show(); + .show().bgiframe(); + }, el.ht.config.showDelay); + } +}; + + +// show the tooltip under the element. +// Introduce a delay, so tip appears only if cursor rests on target for more than an instant. +hovertipShowUnderElement = function(el, o) { + var pos = $(o).offset(); + hovertipHideCancel(el); + if (!hovertipIsVisible(el)) { + el.ht.showing = // keep reference to timer + window.setTimeout(function() { + el.ht.tip.css({ + 'position':'absolute', + 'top': (pos.top + $(o).height()) + 'px', + 'left': pos.left + 'px'}) + .show().bgiframe(); }, el.ht.config.showDelay); } }; @@ -280,7 +298,8 @@ return o.addClass(config.attribute + '_target') .hover(function() { // show tip when mouse over target - hovertipShowUnderMouse(el); +// hovertipShowUnderMouse(el); + hovertipShowUnderElement(el, o); }, function() { // hide the tip @@ -479,4 +498,4 @@ hovertipPrepare, hovertipTargetPrepare); }, 0); -} +};