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
- Web Window API | Window locationbar property
- Web Window API | Window scrollbars property
- Web Window API | DOM Window fullscreen property
- Web Window API | Window personalbar property
- Web Window API | Window statusbar property
- Web Window API | Window toolbar property
- Web Window API | Window menubar property
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.