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()

Let's Work Together!

Javatpoint is passionate to offer better content to the world. Please mail your contribution to We will show your name and create your user profile. You can contribute the following things:
  • Article on Any Topic (which is not available on Javatpoint)
  • Your Interview Experience on Company
  • Company Interview Questions with Answers
  • Recruitment Process of Company
  • Programs, and Algorithm
  • Videos
  • Test Paper
  • Improve Article

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials