How do I get the scroll position of a document?

Somebody picture Somebody · Aug 4, 2010 · Viewed 229.1k times · Source

How to get the scroll position value of a document?

Answer

Demwis picture Demwis · Aug 3, 2011

Here's how to get the scrollHeight of an element obtained using a jQuery selector:

$(selector)[0].scrollHeight

If selector is the id of the element (e.g. elemId), it is guaranteed that the 0-indexed item of the array will be the element you wish to select, and scrollHeight will be correct.