API: slider YAHOO.widget.SliderThumb (YUI Library)

# Yahoo! UI Library

### Slider Widget 2.9.0

Yahoo! UI Library > slider > YAHOO.widget.SliderThumb
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.widget.SliderThumb - extends YAHOO.util.DD

A drag and drop implementation to be used as the thumb of a slider.

### Constructor

YAHOO.widget.SliderThumb `( id , sGroup , iLeft , iRight , iUp , iDown , iTickSize )`

Parameters:
  `id <String>` the id of the slider html element
  `sGroup <String>` the group of related DragDrop items
  `iLeft <int>` the number of pixels the element can move left
  `iRight <int>` the number of pixels the element can move right
  `iUp <int>` the number of pixels the element can move up
  `iDown <int>` the number of pixels the element can move down
  `iTickSize <int>` optional parameter for specifying that the element should move a certain number pixels at a time.

### Properties

#### _graduated - `private boolean`

The slider is _graduated if there is a tick interval defined

#### _isHoriz - `private boolean`

Flag used to figure out if this is a horizontal or vertical slider

#### _prevVal - `private int`

Cache the last value so we can check for change

#### dragOnly - `boolean`

Override the default setting of dragOnly to true.
Default Value: true

#### isTarget - `private object`

Overrides the isTarget property in YAHOO.util.DragDrop

#### maintainOffset - `private boolean`

Informs the drag and drop util that the offsets should remain when resetting the constraints. This preserves the slider value when the constraints are reset

#### parentElId - `string`

The id of the thumbs parent HTML element (the slider background element).

#### scroll - `private object`

Turns off the autoscroll feature in drag and drop

#### startOffset - `[int, int]`

The (X and Y) difference between the thumb location and its parent (the slider background) when the control is instantiated.

#### tickSize - `private int`

The tick size for this slider

### Methods

#### clearTicks

`void clearTicks ( )`
Clear's the slider's ticks

#### getOffsetFromParent

`void getOffsetFromParent ( parentPos )`
Returns the difference between the location of the thumb and its parent.

Parameters:
  `parentPos <[int, int]>` Optionally accepts the position of the parent

#### getValue

`int getValue ( )`
Gets the current offset from the element's start position in pixels.

Returns: `int`
  the number of pixels (positive or negative) the slider has moved from the start position.

#### getXValue

`int getXValue ( )`
Gets the current X offset from the element's start position in pixels.

Returns: `int`
  the number of pixels (positive or negative) the slider has moved horizontally from the start position.

#### getYValue

`int getYValue ( )`
Gets the current Y offset from the element's start position in pixels.

Returns: `int`
  the number of pixels (positive or negative) the slider has moved vertically from the start position.

#### initSlider

`void initSlider ( iLeft , iRight , iUp , iDown , iTickSize )`
Set up the slider, must be called in the constructor of all subclasses

Parameters:
  `iLeft <int>` the number of pixels the element can move left
  `iRight <int>` the number of pixels the element can move right
  `iUp <int>` the number of pixels the element can move up
  `iDown <int>` the number of pixels the element can move down
  `iTickSize <int>` the width of the tick interval.

#### onChange

`private void onChange ( )`
The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider instance it belongs to.

#### toString

`string toString ( )`
Thumb toString

Returns: `string`
  string representation of the instance

Copyright © 2011 Yahoo! Inc. All rights reserved.