views:

23

answers:

2

Hi,

I would like to know if there is any prototype equivalent to the JQuery's .offset() function?

Thanks for your help.

A: 

If you are looking for offset relative to document, go for:

Element.cumulativeOffset

If you are looking for offset relative to an element however, go for:

Element.Offset.

Sarfraz
that link is to a class, not a method :)
James Manning
@James Manning: Sorry i don't get you?
Sarfraz
ah, the edit to include cumulativeOffset is good - when I commented the answer was just a link to Element.Offset which isn't a method (positionedOffset is the method you would use), it's a class the represents an offset (top + left)
James Manning
@James Manning: Ok no problem :)
Sarfraz
A: 

jQuery's offset (element position relative to document) maps to Element.cumulativeOffset

similarly, jQuery's position (element position relative to offset parent) maps to Element.positionedOffset

James Manning