jQuery Tutorial

jQuery scrollTop() Method With Syntax and Example

What is scrollTop method in jQuery?

For the selected components, The scrollTop() method sets or returns the vertical scrollbar position

The position is 0 when the scrollbar is at the top.

Syntax of scrollTop method in jQuery

  • Return vertical scrollbar position:


  • Set vertical scrollbar position:


Example of jQuery scrollTop method

For a

element, get the vertical scrollbar position:


Did you find this article helpful?