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:
- Hide scroll bar, but while still being able to scroll using CSS
- jQuery | scroll() with Examples
- How to scroll automatically to the Bottom of the Page using jQuery?
- How to scroll window using jQuery ?
- How to scroll automatically to a particular element using JQuery?
- How to scroll the page up or down using anchor element in jQuery ?
- How to change style of elements on scroll using jQuery ?
- How to scroll to specific element using jQuery ?
- jQuery | Selectors and Event Methods
- jQuery | event.timeStamp property with Example
- jQuery | event.type property with Examples
- jQuery | event.pageX property with Examples
- jQuery | event.pageY property with examples
- jQuery | event.which property with Examples
- jQuery | event.relatedTarget Property with Example
- jQuery | event.result Property with Examples
- jQuery | event.target Property with Example
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.