The scrollTop() method in jQuery is used to set or return the vertical scrollbar position for the selected elements. With the hep of this method, we can find the mouse scroll direction.
Parameters: This method accepts single parameter position which is optional. It is used to specify the vertical scrollbar position in pixels.
Return Value: It returns the vertical position of the scrollbar of selected element.
- Scrolling in up direction:
- Scrolling in down direction:
- jQuery | scroll() with Examples
- How to scroll window using jQuery ?
- How to scroll automatically to the Bottom of the Page using jQuery?
- jQuery | event.data Property
- jQuery | event.isDefaultPrevented() Method
- jQuery | Selectors and Event Methods
- jQuery | event.which property with Examples
- jQuery | event.stopPropagation() Method
- jQuery | event.target Property with Example
- jQuery | event.isPropagationStopped() Method
- jQuery | event.relatedTarget Property with Example
- jQuery | event.delegateTarget Property
- jQuery | event.isImmediatePropagationStopped() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.