A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/TextRange/scrollIntoView below:

scrollIntoView · WebPlatform Docs

scrollIntoView Summary

Causes the object to scroll into view, aligning it either at the top or bottom of the window.

Method of dom/TextRangedom/TextRange

Syntax
var result = node.scrollIntoView();
Parameters varargStart
Data-type
VARIANT

Variant of type Boolean that specifies one of the following values:

Return Value

Returns an object of type DOM NodeDOM Node

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

This example uses the scrollIntoView method to underline the content of the document’s fifth paragraph and scroll it into view at the top of the window.

var coll = document.all.tags("P");
   if (coll.length >= 5)
   {
      coll(4).style.textDecoration = "underline";
      coll(4).scrollIntoView(true);
   }
Usage
 The scrollIntoView method is useful for immediately showing the user the result of some action without requiring the user to manually scroll through the document to find the result.
Notes Remarks

Depending on the size of the given object and the current window, this method might not be able to put the item at the very top or very bottom, but will position the object as close to the requested position as possible.

Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4