The Window scrollTo() method is used to scroll to a particular set of coordinates in the document.
Parameters: The scrollTo() method accepts two parameters as described below:
- x-coord: It is the pixel along the horizontal axis of the document that is displayed in the upper left. It is the required field.
- y-coord: It is the pixel along the vertical axis of the document that is displayed in the upper left. It is the required field.
Before clicking the button:
After clicking the button:
Supported Browsers: The browser supported by Window scrollTo() Method are listed below:
- Google Chrome
- Internet Explorer
- Firefox 1.0
- Window | Window.requestAnimationFrame() Method
- HTML | Window moveBy() Method
- HTML | Window scrollBy() 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.