Mozilla.com

  1. MDC
  2. Main Page
  3. DOM
  4. window.scrollBy

« Gecko DOM Reference

Summary

Scrolls the document in the window by the given amount.

Syntax

window.scrollBy(X,Y);

Parameters

  • X is the offset in pixels to scroll horizontally.
  • Y is the offset in pixels to scroll vertically.

Positive co-ordinates will scroll to the right and down the page. Negative values will scroll to the left and up the page.

Example

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

Notes

window.scrollBy scrolls by a particular amount where window.scroll scrolls to an absolute position in the document. See also window.scrollByLines, window.scrollByPages

Specification

DOM Level 0. Not part of specification.

Languages

Page last modified 17:00, 17 Feb 2008 by Mgjbot

Files (0)