scroll method (window)
Scrolls the contents of the document window to the specified horizontal and vertical positions.
- If you want to scroll the document by a specified number of pixels, use the scrollBy method.
- The position of the document's scrollbars can be retrieved with the scrollLeft and scrollTop properties. These properties can be used to specify or retrieve the position of the scrollbars of an element and the document.
- To get the maximum scrolling positions, use the scrollWidth, scrollHeight and clientWidth, clientHeight properties.
- If you want to scroll an element into the visible area, you can use the scrollIntoView method.
You can find the related objects in the Supported by objects section below.
|Required. Integer that specifies the horizontal position.|
|Required. Integer that specifies the vertical position.|
This method has no return value.
Example HTML code 1:
This example shows how to scroll the document window to a specified position:
Did you find this example helpful?
User Contributed Comments