JavaScript Window scrollTo()
JavaScript Window scrollTo()
The scrollTo() method is used for scrolling the document to the specified coordinates. This property only works when the document is larger than the screen.
Syntax:-
Its syntax is:- window.scrollTo(x, y) OR scrollTo(x, y)
Further Explanation:-
Parameter | Description |
x | Required. The coordinate to scroll horizontally in pixels. |
y | Required. The coordinate to scroll vertically in pixels. |