Easy Tutorial
❮ Prop Video Duration Prop Node Namespaceuri ❯

Window scrollBy() Method

Window Object


Definition and Usage

The scrollBy() method scrolls the content by a specified number of pixels.

Note: For this method to work, the visible property of the window scrollbar must be set to true!

Syntax

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 down.

Browser Support

All major browsers support the scrollBy() method.


Example

Scroll the content by 100 pixels:

function scrollWindow() {
    window.scrollBy(100, 100);
}

Window Object

❮ Prop Video Duration Prop Node Namespaceuri ❯