scrollBy (value, percent, fireEvent);
value. The distance, by which to move the slider from its current 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 this parameter is set to true, event is fired. By default the event is not fired.
The scrollBy method moves the slider by a certain distance from its current position.
To execute the example, in the <head> tag add links to the library PP.js and visual styles PP.css. Create a scrollbar.
<script type="text/javascript"> var hScrollBar = new PP.Ui.ScrollBar({ ParentNode: document.getElementById("scroll1") }); hScrollBar.setSize(200, 16); hScrollBar.setDraggerSize(20); hScrollBar.updateSize(); hScrollBar.setValue(20, false); hScrollBar.scrollBy(30, true); </script>
After executing the example a scrollbar with a slider positioned in its center is placed in the HTML page.
See also: