Window scrollTo()Method
Window Object
Definition and Usage
The scrollTo() method scrolls the content to specified coordinates.
Syntax
scrollTo(xpos,ypos)
| Parameters | Description |
|---|---|
| xpos | Required. The x-coordinate of the document to be displayed in the upper-left corner of the window's document display area. |
| ypos | Required. The y-coordinate of the document to be displayed in the upper-left corner of the window's document display area. |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the scrollTo() method.
Example
Example
Scroll the content to coordinate position 100,500:
function scrollWindow(){
window.scrollTo(100,500);
}
window.scrollTo(100,500);
}
Try it Yourself »
Window Object Other Extensions