Name
HTMLElement.scrollIntoView( ): make an element visible â Firefox 1.0, IE 4, Safari 2.02, Opera 8.5
Synopsis
element
.scrollIntoView(top
)
Arguments
-
top
An optional boolean argument that specifies whether the element should be scrolled to the top (
true
) or bottom (false
) of the screen. This argument is not supported by all browsers, and elements near the top or bottom of a document cannot usually be scrolled to the opposite edge of the window, so this argument should be considered only a hint.
Description
If an HTML element is not currently visible in the window,
this method scrolls the document so that it becomes visible. The
top
argument is an optional hint about
whether the element should be scrolled to the top or bottom of the
window. For elements that accept the keyboard focus, such as the
Link and Input elements, the focus(
)
method implicitly performs this same scroll-into-view
operation.
See Also
Anchor.focus( )
, Input.focus( )
, Link.focus( )
, Window.scrollTo( )
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.