# Yahoo! UI Library

### Slider Widget 2.8.1

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

#### Properties inherited from YAHOO.util.DD:

`scroll`

#### Properties inherited from YAHOO.util.DragDrop:

`__ygDragDrop, _domRef, available, config, constrainX, constrainY, cursorIsOver, deltaX, deltaY, dragElId, dragOnly, events, groups, handleElId, hasOuterHandles, id, invalidHandleClasses, invalidHandleIds, invalidHandleTypes, isTarget, locked, maintainOffset, maxX, maxY, minX, minY, overlap, padding, primaryButtonOnly, startPageX, startPageY, useShim, xTicks, yTicks`

### 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

#### Methods inherited from YAHOO.util.DD:

`alignElWithMouse, autoOffset, autoScroll, cachePosition, setDelta, setDragElPos`

#### Methods inherited from YAHOO.util.DragDrop:

`addInvalidHandleClass, addInvalidHandleId, addInvalidHandleType, addToGroup, applyConfig, b4Drag, b4DragDrop, b4DragOut, b4DragOver, b4EndDrag, b4MouseDown, b4StartDrag, clearConstraints, clearTicks, clickValidator, endDrag, getDragEl, getEl, getTargetCoord, getTick, handleMouseDown, handleOnAvailable, init, initTarget, isLocked, isValidHandleChild, lock, on, onAvailable, onDrag, onDragDrop, onDragEnter, onDragOut, onDragOver, onInvalidDrop, onMouseDown, onMouseUp, removeFromGroup, removeInvalidHandleClass, removeInvalidHandleId, removeInvalidHandleType, resetConstraints, setDragElId, setHandleElId, setInitialPosition, setOuterHandleElId, setPadding, setStartPosition, setXConstraint, setXTicks, setYConstraint, setYTicks, startDrag, toString, unlock, unreg`

#### Events inherited from YAHOO.util.DD:

`b4DragDropEvent, b4DragEvent, b4DragOutEvent b4DragOverEvent b4EndDragEvent b4MouseDownEvent b4StartDragEvent dragDropEvent dragEnterEvent dragEvent dragOutEvent dragOverEvent endDragEvent invalidDropEvent mouseDownEvent mouseUpEvent startDragEvent`

#### Events inherited from YAHOO.util.DragDrop:

`b4DragDropEvent, b4DragEvent, b4DragOutEvent, b4DragOverEvent, b4EndDragEvent, b4MouseDownEvent, b4StartDragEvent, dragDropEvent, dragEnterEvent, dragEvent, dragOutEvent, dragOverEvent, endDragEvent, invalidDropEvent, mouseDownEvent, mouseUpEvent, startDragEvent,`

Copyright © 2010 Yahoo! Inc. All rights reserved.