class SAPO.Component.Slider
Version:
2.1
 requires SAPO.Dom.Event
 requires SAPO.Dom.Element
 requires SAPO.Dom.Css
 
creates a Slider
Defined in Component/Slider/2.1/lib.js

Constructor Summary
Slider (String|DomElement element, Object _options)

Function Summary
String addCue (Object o)
adds a cue mark to the slider
removes all cues
orderly removes DOM stuff
Number getBar ([Number index])
gets the slider bar's value
Object getCue (String id)
returns the cue info
Number getValue()
gets the slider value
Boolean removeCue (String id)
removes the cue given its id
Number setBar (Number value, [Number index])
updates the slider bar, returning the validated value
Number setValue (Number value, [Boolean madeByTheUser])
updates the slider value, returning the validated value
update()
call this when the major dimension changes or min, max option changes

Constructor Details

constructor Slider

Slider(String|DomElement element, Object _options)
Parameters:
element - block element which will be populated with the slider
_options
  • [ String elementId ] - id that the slider will be attributed
  • [ Number min ] - minimum value the slider can be set to
  • [ Number max ] - maximum value the slider can be set to
  • [ Number step ] - minimum gap allowed between values
  • [ Number startValue ] - initial value
  • [ String orientation ] - either 'horizontal' or 'vertical'. Defaults to 'horizontal'
  • [ String cssURI ] - URI to alternate CSS file for styling the slider
  • [ Function onStart ] - callback that gets called when a drag starts
  • [ Function onChange ] - callback that gets called during a drag
  • [ Function onEnd ] - callback that gets called when a drag end
  • [ Function onHover ] - callback that hets called when hovering the slider
  • [ Function onHoverEnded ] - callback that hets called when hoverTimeout time passed after the last hover
  • [ Boolean supportClick ] - clicking on the bar moves the ball to its position. enabled by default
  • [ Boolean barFollowsValue ] - default is false. if true, bar always appears locked to the value.
  • [ Number hoverTimeout ] - time until hoverEnded is triggered, in ms (default is 800)
  • [ Boolean invert ] - inverts axis direction
  • [ Number startBar ] - displays a bar in the background
  • [ Number changeThrottlingTime ] - only every n milisseconds will changes be visibly updated. by default 100 ms.

Function Details

function addCue

String addCue(Object o)
adds a cue mark to the slider
Parameters:
o
  • Number value cue value
  • [ String id ]
  • [ String title ]
  • [ String color ] cue color
  • [ Number width ] in pixels. default is 1
Returns:
{String} returns the cue id, useful for removing it later on...

function clearCues

clearCues()
removes all cues

function destroy

destroy()
orderly removes DOM stuff

function getBar

Number getBar([Number index])
gets the slider bar's value
Parameters:
[index] defaults to 0

function getCue

Object getCue(String id)
returns the cue info
Parameters:
id cue id to fetch for

function getValue

Number getValue()
gets the slider value

function removeCue

Boolean removeCue(String id)
removes the cue given its id
Parameters:
id cue id to remove
Returns:
{Boolean} true if cue was found and removed, false otherwise

function setBar

Number setBar(Number value, [Number index])
updates the slider bar, returning the validated value
Parameters:
value value to assign to the bar
[index] defaults to 0

function setValue

Number setValue(Number value, [Boolean madeByTheUser])
updates the slider value, returning the validated value
Parameters:
value value to apply to the slider
[madeByTheUser] iif trueish witll the onChange event be triggered

function update

update()
call this when the major dimension changes or min, max option changes