Slider Class

Basic horizontal slide control. Can be used as a range slider, play control, etc. Supports touch devices. Credit: http://css3wizardry.com/2010/09/14/range-slider-with-css-and-javascript/

Constructors

Slider( parent, config )
Used to instantiate this class
parentDOM element in which to render this component
configConfiguration settings (optional). See config options for more information.

Config Options

value
Initial value for the slider
disabled
If true, the slider will be disabled when it is initialized. The slider can be enabled and disabled using the enable() and disable() methods.
style
Style for individual elements within the component. Note that you can provide CSS class names instead of individual style definitions.

Events

onRender( )
Called after the slider has been added to the DOM
onDrag( val )
Called whenever the slider handle is dragged by the user.
onChange( val )
Called whenever the position of the slider handle has changed.

Public Methods

enable( )
Used to enable the slider.
disable( )
Used to disable the slider.
isEnabled( )
Returns true if the slider is enabled.
isDisabled( )
Returns true if the slider is disabled.
getValue( returnPercentage )
Returns the value of the slider.
returnPercentageOptional. If true, returns a percentage value. Otherwise, returns the current position of the slider in pixels.
getWidth( )
Returns the width of the slider. This, together with the getValue() method, can be used to compute a percentage value.
setValue( x, silent )
Used to set the position of the slider.
xAccepts a number representing pixels from the left or a string representing a percentage value (e.g. '50%')
silentIf true, will not fire the onChange event