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:
- How to scroll window using jQuery ?
- jQuery | scroll() with Examples
- How to scroll automatically to the Bottom of the Page using jQuery?
- jQuery | event.target Property with Example
- jQuery | event.relatedTarget Property with Example
- jQuery | event.stopImmediatePropagation() Method
- jQuery | event.currentTarget Property
- jQuery | event.which property with Examples
- jQuery | Selectors and Event Methods
- jQuery | event.data Property
- jQuery | event.isDefaultPrevented() Method
- jQuery | event.stopPropagation() 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 email@example.com. 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.