Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

window.scrollByLines Redirect 1

 

Summary

Scrolls the document by the given number of lines.

Syntax

window.scrollByLines(lines) 

Parameters

  • lines is the number of lines to scroll the document by.
  • lines may be a positive or negative integer.

Example

<!-- scroll down the document by 5 lines. -->
<button onclick="scrollByLines(5);">down 5 lines</button>
<!-- scroll up the document by 5 lines. -->
<button onclick="scrollByLines(-5);">up 5 lines</button>

Specification

DOM Level 0. Not part of any standard.

See also

Document Tags and Contributors

 Last updated by: Sheppy,