On 17/08/06, John Resig <[EMAIL PROTECTED]> wrote:
> > Or maybe a better way (having left, right, top etc as methods):
> >
> > // set left, top and height (chain not broken)
> > $("#myelement").left("12px").top("-2em").height("6em");
> > // get width (chain broken)
> > var width = $("#myelement").width();
>
> Have you tried this yet? It works, verbatim. :-)
>
> All those methods are detailed in the new docs (temporary URL):
> http://john.jquery.com/jquery/docs/
>
> --John
>

The problem is if you want the dimensions of an element that is not
positioned via CSS, i.e. to get the left position:

var left = el.offsetLeft;
do
{
  el = el.offsetParent, left+= el.offsetLeft, top+= el.offsetTop;
}
while (el.offsetParent);

I think offsetLeft (and offsetTop, offsetWidth, offsetHeight) are
supported by all those browsers jQuery works with - as el.y and el.x
are for Netscape 4.

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to