Window scrollTo() Method
Window Object
Definition and Usage
The scrollTo() method scrolls the content to the specified coordinates.
Syntax
scrollTo(
xpos,ypos
)
| Parameters | Description |
|---|---|
| xpos | Required. The x-coordinate of the document to be displayed at the upper-left corner of the window's viewport. |
| ypos | Required. The y-coordinate of the document to be displayed at the upper-left corner of the window's viewport. |
Browser support





All major browsers support the scrollTo() method.
Example
Example
Scroll the content to the coordinates 100,500:
function scrollWindow(){
window.scrollTo(100,500);
}
Try it »
Window Object