Measuring Visible Tooltip Dimensions:
In order for the dimensions of the tooltip to be measured it first must be appended to the document. This will automatically make it appear on the page, so to prevent the user seeing it display in the wrong position, we need to hide it. We do so by setting is "visibility" to "hidden" until we have finalized the tooltip's position.
We can't use the more familiar "display" property here, because objects with "display" set to "none" are not rendered at all, so they have no dimensions to measure.
On 8/30/06, Klaus Hartl <[EMAIL PROTECTED]> wrote:
John Resig schrieb:
>> position: "absolute" becomes position: "static", prependTo("body")[0]
>> becomes prependTo(e.parentNode)[0]
>
> However, the problem continues to be that you can't do that without
> severe implications. Since you're adding an additional element into
> the parent, it will push the rest of the contents down - and that will
> definitely cause a flash of content moving around. If we can ever,
> reliably, figure out how to get the accurate height/width of an
> element that has display: none, that'll sure be nice.
I see. The problem is, that if you set something to position: absolute,
it shrinks to fit. Maybe this is also the reason why the height is
miscalculated.
Another point is that if I append some element to the body, it may
inherit other styles than where it originally was. Apart from that, in
my case the element in question is a <dd> element. Appending that to the
body results in invalid html, and than results may be unpredictable anyway.
And I couldn't see that flash of content although, but maybe my computer
is too fast.
Maybe you could wrap another element around it with overflow: hidden and
height: 0, not sure if that works...
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
