JavaScript Window method: scrollBy()
[this page | pdf | back links]
The scrollBy() method (when applied to Window
objects in the JavaScript
BOM) scrolls the
document by specified number of pixels.
Note: the visible property of the window’s
scrollbar needs to be set to true for this method to work.
It
has the following syntax with the following parameters. It does not return a
value.
window.scrollBy(x, y)
|
Parameter
|
Required / Optional
|
Description
|
|
x
|
Required
|
Positive or negative
number specifying number of pixels to scroll by (positive causes scroll to
right, negative scroll to the left)
|
|
y
|
Required
|
Positive or negative
number specifying number of pixels to scroll by (positive causes scroll down,
negative scroll up)
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)