This gives me the position of some element from the left edge of the main window:
$(\'#bar\').offset().left;
If that element is situated in
It's simple enough: get the offset of the element and substract the offset of its parent.
var elem = $("#bar"); var offset = elem.offset().left - elem.parent().offset().left;