jQuery | scrollTop() with Examples
The scrollTop() method is an inbuilt method in jQuery which is used to return the vertical top position of the scrollbar.
Parameters: This method accepts single parameter position which is optional. It is used to specify vertical scrollbar position in pixels.
Return Value: This method returns the top position of the scroll bar.
Below example illustrates the scrollTop() method in jQuery:
Before click on the button:
Pixel value of the top position shown in above figure: