This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

scrollBy

Summary

Causes the window to scroll relative to the current scrolled position by the specified x- and y-pixel offset.

Method of dom/Windowdom/Window

Syntax

 window.scrollBy(/* see parameter list */);

Parameters

x

Data-type
Number

Integer that specifies the horizontal scroll offset, in pixels. Positive values scroll the window right, and negative values scroll it left.

y

Data-type
Number

Integer that specifies the vertical scroll offset, in pixels. Positive values scroll the window down, and negative values scroll it up.

Return Value

No return value

Examples

// scroll one page
window.scrollBy(0, window.innerHeight);

Syntax

Standards information

There are no standards that apply here.

Attributions