A RetroSearch Logo

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

Search Query:

Showing content from https://webplatform.github.io/docs/dom/HTMLElement/scrollTop below:

scrollTop · WebPlatform Docs

scrollTop

Property of dom/HTMLElementdom/HTMLElement

Syntax
var result = element.scrollTop;
element.scrollTop = value;
Examples

This example uses the scrollTop property to determine the amount scrolled by the object.

<div id="oDiv" style="position: absolute;
    width: 200px;
    height: 100px;
    overflow: scroll"
    onclick="alert(this.scrollTop)">
    <span style="width: 250px">. . . </span>
</div>

View live example

Notes Remarks

This property’s value equals the current vertical offset of the content within the scrollable range. Although you can set this property to any value, if you assign a value less than 0, the property is set to 0. If you assign a value greater than the maximum value, the property is set to the maximum value. You can set this property inline, but the results might be inconsistent while the document is loading. This property is always 0 for objects that do not have scroll bars. For these objects, setting the property has no effect. When a marquee object scrolls horizontally, its scrollTop property is set to 0, overriding any script setting. For more information about how to access the dimension and location of elements on the document through the Dynamic HTML (DHTML) Object Model, see Measuring Element Dimension and Location with CSSOM in Internet Explorer 9.

Syntax 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