ScrollBox.getHorisontalScrollPosition

Syntax

getHorisontalScrollPosition ();

Description

The getHorisontalScrollPosition method returns position of horizontal scrollbar slider.

Example

To execute the example, the tag HEAD must include links to the PP.js library and the visual PP.css style table. Add an area with scrollbars to HTML page, scroll the area vertically and horizontally by half of the horizontal scrollbar width and vertical scrollbar height. Show scrollbar sliders positions to the console:

<body>
<div id="example"></div>
    <script type="text/javascript">
        var sb = new PP.Ui.ScrollBox({
            ParentNode: "example",
            Content: "yyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyy yyyyyyyyyyyyyy yyyyyyyyyyyy",
            Width: 90,
            Height: 90
        });
        sb.scrollTo(sb.getScrollHeight() / 2, sb.getScrollWidth() / 2);
        console.log("Horizontal position: " + sb.getHorizontalScrollPosition() + ", vertical position: " + sb.getVerticalScrollPosition());
    </script>
</body>

After executing the example the ScrollBox component is placed in the page. The component looks as follows:

The browser console displays the following information:

Horizontal position: 61, vertical position: 52

See also:

ScrollBox