jQuery UI API - Slider Widget
Category
Usage
**Description:** Drag a handle to select a numeric value.
**Version added:** 1.5
The jQuery UI Slider plugin allows selection via a slider. There are various options, such as multiple handles and ranges. Handles can be moved with the mouse or arrow keys.
The Slider Widget creates handle elements with the ui-slider-handle class at initialization. You can specify custom handle elements by creating and appending elements before initialization and adding the ui-slider-handle class to them. It only creates as many handles as are needed to match the value/values length. For example, if you specify values: [ 1, 5, 18 ]and create one custom handle, the plugin will create the other two.
Theming
The Slider Widget uses jQuery UI CSS Framework to define the style of its look and feel. To use slider-specific styling, you can use the following CSS class names:
ui-slider: The track of the slider control. Depending on the slider'sorientationthis element additionally has aui-slider-horizontalorui-slider-verticalclass。ui-slider-handle: The slider handle.ui-slider-rangeWhen therangeThe selected range used when therangeoption is set to"min"or"max", this element additionally has aui-slider-range-minorui-slider-range-maxclass。
Depends on
Additional Notes
- This widget requires some functional CSS; otherwise it will not work. If you create a custom theme, use the widget-specific CSS file as a starting point.
Example
A simple jQuery UI slider.
滑块部件(Slider Widget)演示