Klaus,

Humm, I still can't get the size of an element while it's hidden and
absolute...

I tried with an element:

style="display: none; position: absolute"

and

alert("id: " + elt.id + " height: " + elt.offsetHeight + " width: " +
elt.offsetWidth);
alert("id: " + elt.id + " style.height: " + elt.style.height + " style.width:
" + elt.style.width);

I still get height:0 and width:0 and style.height "" as well as style.width.

Did you mean that the element position is made absolute, moved off screen
and made visible to get its size and then made static and hidden again?

Thanks

Fred

On 6/17/07, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
>
> Fred Janon wrote:
> > Hi,
> >
> > I am trying to understand how the height of an element is calculated in
> > jQuery. I don't understand how the height can be calculated especially
> > when the element is hidden with display:none.
> >
> > Thanks
> >
> > Fred
> >
>
> Fred,
>
> if the particular element is hidden, it is absolutely positioned while
> invisible (and the parent element its context), instead of "display:
> none", and the height can then be calculated. Thereafter these styles
> are resetted.
>
> There is one issue: If not the element itself but some parent element is
> hidden via setting display to none, you won't get the correct height.
> Its just to expensive to use the above described technique for some
> parent element.
>
>
>
> --Klaus
>

Reply via email to