scrollTop() method in jQuery

scrollTop() in jQuery

This method is used to Get or Set the current vertical position of the scroll bar of the first element in the set of matched elements.

The vertical scroll position denotes the number of pixels that are hidden above the scrollable area.

If the scrollbar is disabled, not scrollable , or if it is at the top end position the value will be zero.



  • value - It denotes a number indicating the new position of scroll bar.

Example 1 - get

Try Yourself

Example 2 - Scroll to bottom position, specified by a value

Try Yourself