Sometimes, when I ask for the .position().top
value of some object, it does not return the absolute value, i.e. if some picture is added before, the .position().top
value does not change. How may I ask for the absolute position of an object (in this case a div)?
Answer
From the jquery docs:
The .position() method allows us to retrieve the current position of
an element relative to the offset parent. Contrast this with
.offset(), which retrieves the current position relative to the
document.
http://api.jquery.com/position/
So use .offset()
.
No comments:
Post a Comment