Thursday, 3 February 2011

jQuery .scrollTop()

Get the current vertical position of the scroll bar for the first element in the set of matched elements.

The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0.

For example the following line gets the scrollTop of current window.

$(window).scrollTop();

No comments:

Post a Comment