Tag Archives: jquery scrollTop div
jQuery scrollTop Method
jQuery .scrollTop Method : is used to get or set the vertical scrollbar position of the selected element.
jQuery scrollTop Method Syntax 1 – Get The Position
Syntax for get position of scrollbar from top –
$(selector).scrollTop();
jQuery scrollTop() Method Example 1
Below example shows the position of the scrollbar from the top-
jQuery scrollTop Method Syntax 2 – Set The Position
Syntax to set position of the scrollbar from top –
$(selector).scrollTop(position);
position(px): Pixel position to be scrolled.
jQuery scrollTop() Method Example 2
Here is an example which will set position of scrollbar from top –
The above example will produce output something like this –