This question is quite similar to what I want I'm looking for, but my situation is different enough, I think, to merit a new question.
I have several divs positioned absolutely inside of a parent div (position: relative
). I want to get the position of the children divs relative to the window. The jquery offset()
method doesn't seem to work, because it gives me the offset from the parent div. Is there a way to get the absolute position of a div that has absolute position inside of a relative position div?
Sample html:
<div id="parent" style="position:relative;">
<div id="child1" style="position:absolute; top:10px; left 8px;">Child 1</div>
<div id="child2" style="position:absolute; top:20px; left 8px;">Child 2</div>
</div>