Yahoo! UI Library

Slider Widget  2.5.1

Yahoo! UI Library > slider > YAHOO.widget.DualSlider

Show Private Show Protected

Class YAHOO.widget.DualSlider - uses YAHOO.util.EventProvider

A slider with two thumbs, one that represents the min value and the other the max. Actually a composition of two sliders, both with the same background. The constraints for each slider are adjusted dynamically so that the min value of the max slider is equal or greater to the current value of the min slider, and the max value of the min slider is the current value of the max slider. Constructor assumes both thumbs are positioned absolutely at the 0 mark on the background.

Constructor

YAHOO.widget.DualSlider ( minSlider , maxSlider , range , initVals )
Parameters:
minSlider <Slider> The Slider instance used for the min value thumb
maxSlider <Slider> The Slider instance used for the max value thumb
range <int> The number of pixels the thumbs may move within
initVals <Array> (optional) [min,max] Initial thumb placement

Properties

activeSlider - Slider

The currently active slider (min or max). read only

isHoriz - boolean

Is the DualSlider oriented horizontally or vertically? read only

maxSlider - Slider

A slider instance that keeps track of the upper value of the range. read only

maxVal - int

The current value of the max thumb. read only.

minRange - int

Pixel distance to maintain between thumbs.
Default Value: 0

minSlider - Slider

A slider instance that keeps track of the lower value of the range. read only

minVal - int

The current value of the min thumb. read only.

Methods

_cleanEvent

private void _cleanEvent ( o , evt )
Clean up the slideEnd event subscribers array, since each one-time callback will be replaced in the event's subscribers property with null. This will cause memory bloat and loss of performance.
Parameters:
o <EventProvider> object housing the CustomEvent
evt <string> name of the CustomEvent
Returns: void

_handleDrag

private void _handleDrag ( )
Overrides the onDrag method for both sliders
Returns: void

_handleMaxChange

private void _handleMaxChange ( )
Executed when the max slider fires the change event
Returns: void

_handleMinChange

private void _handleMinChange ( )
Executed when the min slider fires the change event
Returns: void

_handleSlideEnd

private void _handleSlideEnd ( )
Executed when one of the sliders fires the slideEnd event
Returns: void

_handleSlideStart

private void _handleSlideStart ( )
Executed when one of the sliders fires the slideStart event
Returns: void

_oneTimeCallback

private void _oneTimeCallback ( o , evt , fn )
Schedule an event callback that will execute once, then unsubscribe itself.
Parameters:
o <EventProvider> Object to attach the event to
evt <string> Name of the event
fn <Function> function to execute once
Returns: void

handleMouseDown

private void handleMouseDown ( )
Overrides the onMouseDown for both slider, only moving the active slider
Returns: void

selectActiveSlider

private void selectActiveSlider ( e )
A background click will move the slider thumb nearest to the click. Override if you need different behavior.
Parameters:
e <Event> the mousedown event
Returns: void

setMaxValue

void setMaxValue ( max , skipAnim , force , silent )
Set the max thumb position to a new value.
Parameters:
max <int> Pixel offset for max thumb
skipAnim <boolean> (optional) Set to true to skip thumb animation. Default false
force <boolean> (optional) ignore the locked setting and set value anyway. Default false
silent <boolean> (optional) Set to true to skip firing change events. Default false
Returns: void

setMinValue

void setMinValue ( min , skipAnim , force , silent )
Set the min thumb position to a new value.
Parameters:
min <int> Pixel offset for min thumb
skipAnim <boolean> (optional) Set to true to skip thumb animation. Default false
force <boolean> (optional) ignore the locked setting and set value anyway. Default false
silent <boolean> (optional) Set to true to skip firing change events. Default false
Returns: void

setValues

void setValues ( min , max , skipAnim , force , silent )
Sets the min and max thumbs to new values.
Parameters:
min <int> Pixel offset to assign to the min thumb
max <int> Pixel offset to assign to the max thumb
skipAnim <boolean> (optional) Set to true to skip thumb animation. Default false
force <boolean> (optional) ignore the locked setting and set value anyway. Default false
silent <boolean> (optional) Set to true to skip firing change events. Default false
Returns: void

updateValue

private void updateValue ( silent )
Executed when one of the sliders is moved
Parameters:
silent <boolean> (optional) Set to true to skip firing change events. Default false
Returns: void

Events

change

change ( dualslider )
Event that fires when either the min or max value changes
Parameters:
dualslider <DualSlider> the DualSlider instance

ready

ready ( dualslider )
Event that fires when the slider is finished setting up
Parameters:
dualslider <DualSlider> the DualSlider instance

slideEnd

slideEnd ( activeSlider )
Event that fires when one of the thumbs finishes moving
Parameters:
activeSlider <Slider> the moving slider

slideStart

slideStart ( activeSlider )
Event that fires when one of the thumbs begins to move
Parameters:
activeSlider <Slider> the moving slider


Copyright © 2007 Yahoo! Inc. All rights reserved.