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 visibility property of the window scrollbar must be set to true!
Syntax
scrollBy(xnum,ynum)
| Parameter | Description |
|---|---|
| xnum | Required. The number of pixels to scroll the document to the right. |
| ynum | Required. The number of pixels to scroll the document downward. |
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 Yourself »
Other Extensions
Window Object