Javatpoint Logo
Javatpoint Logo

jQuery scrollTop()

The jQuery scrollTop method is used to set or return the vertical scrollbar position for the selected element. When the scrollbar is on the top, it specifies the position 0.

  • To return the position: When this method is used to return the position, it provides the current vertical position of the first matched element in the set.
  • To set the position: When this method is used to set the position, it sets the vertical position of the scrollbar for all matched element.


To return vertical scrollbar position:

Parameters of jQuery scrollTop() method

Parameter Description
Position It specifies the vertical scrollbar position in pixels.

Example of jQuery scrollTop() method

Let's take an example to demonstrate the jQuery scrollTop() method.

Test it Now

Another example of jQuery scrollTop()

Test it Now
Next TopicjQuery attr()

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA