Be aware that style.top is not necessarily the position of an element.
You can use $('TheDivInQuestion').position().top (and $
('TheDivInQuestion').position().left) to find it's actual position.

On Feb 9, 11:07 am, Michael Lawson <mjlaw...@us.ibm.com> wrote:
> If you look at the documentation for jQuery you'll see that many jQuery
> functions either return jQuery itself, or an array of elements.  Your usage
> would return an array of the element in question so you might want to try
> something like this
> $("#TheDivInQuestion")[0].style.top
>
> Hope that helps!
>
> cheers
>
> Michael Lawson
> Content Tools Developer, Global Solutions, ibm.com
> Phone:  1-919-517-1568 Tieline:  255-1568
> E-mail:  mjlaw...@us.ibm.com
>
> 'Examine my teachings critically, as a gold assayer would test gold. If you
> find they make sense, conform to your experience, and don't harm yourself
> or others, only then should you accept them.'
>
>   From:       Paul Hutson <hutsonphu...@googlemail.com>                       
>                                    
>
>   To:         "jQuery (English)" <jquery-en@googlegroups.com>                 
>                                    
>
>   Date:       02/09/2009 02:02 PM                                             
>                                    
>
>   Subject:    [jQuery] Getting Style Information (left/top)                   
>                                    
>
> Hello,
>
> I'm a(nother?) new person to Jquery and have found it to be
> *excellent* so far (when I say that I may be understating how damned
> awesome it is!!)
>
> There is only one thing that has been bothering me - I can't seem to
> find a way of finding a position of an item with an easy Jquery
> shortcut.
>
> i.e. to find out the style.top value of an element, I have to use the
> following :
>
> document.getElementById("TheDivInQuestion").style.top
>
> Am I missing something that does this with something like : $
> ("#TheDivInQuestion").top or $("#TheDivInQuestion").style.top :?
>
> (both of which don't work for me..)
>
> Thanks in advance,
> Paul Hutson
>
>  graycol.gif
> < 1KViewDownload
>
>  ecblank.gif
> < 1KViewDownload

Reply via email to