jQuery scrollTop() Method
jQuery scrollTop() Method
The scrollTop() method is used to set or return the vertical scrollbar position for the selected elements.
For your Information:-
- It is used to return the vertical position of the scrollbar for the FIRST matched element.
- It is used to set the vertical position of the scrollbar for ALL matched elements.
When the scrollbar is on the Top, the position will be 0.
Syntax:-
Its syntax is:- $(selector).scrollTop() OR $(selector).scrollTop(position)
Further Explanation:-
Parameter | Description |
---|---|
position | Specifies the vertical scrollbar position in pixels |