scrollTo (position, percent, fireEvent);
position. Distance between the scrollbar left end and the slider position.
percent. Determines type of value specified in the value parameter: true - percent, false - absolute value. By default an absolute value is set in pixels.
fireEvent. Determines whether to fire the ScrollBar.MoveScroll event on method execution. If the parameter is set to True, event is fired. By default the event is not fired.
The scrollTo method moves the slider to the specified position.
To execute the example, in the <head> tag add links to PP.js library and PP.css visual styles. Create a scrollbar.
<script type="text/javascript"> var hScrollBar = new PP.Ui.ScrollBar({ ParentNode: document.getElementById("scroll1") }); hScrollBar.setSize(200, 16); hScrollBar.setDraggerSize(50); hScrollBar.updateSize(); hScrollBar.scrollTo(50); </script>
After executing the example a scrollbar with a slider shifted by 50 pixels left is placed on the HTML page.
See also: