Window scrollBy() Method
Definition and Usage
The scrollBy() method scrolls the content by the specified number of pixels.
Note: For this method to work, the window scrollbar's visible attribute must be set to true!
Syntax
scrollBy(
xnum,ynum
)
| Parameters | Description |
|---|---|
| xnum | Required. The number of pixels to scroll the document to the right. |
| ynum | Required. The number of pixels to scroll the document down. |
Browser support





All major browsers support the scrollBy() method.
Example
Example
Scroll the content by 100 pixels:
function
scrollWindow
(
)
{
window
.
scrollBy
(
100
,
100
)
;
}
Try it »
Window Object