Try to calculate it as a function of the position of the element relative to the scroll position of the window: http://jsfiddle.net/va836/
var position = $('selector').position().left - $(window).scrollLeft();
You may also need to consider the position relative to other elements if it is not a top-level element.
This is actually even simpler - just use offset() and omit the parent count.
var position = $('selector').offset().left - $(window).scrollLeft();
source share