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
Use the position() method.
$('#bar').position().left;