title | page_title | description |
---|---|---|
Slider |
Configuration, methods and events of Kendo UI Slider |
Configuration of Slider UI control, different methods, and events, triggered when the slider value changes upon specific conditions. |
Represents the Kendo UI Slider widget. Inherits from Widget.
The title of the decrease button of the Slider.
The title of the drag handle of the Slider.
The title of the increase button of the Slider.
The delta with which the value will change when the user presses the Page Up or Page Down key (the drag
handle must be focused). Note: largeStep
will also set a large tick for every large step.
Must be a positive number, larger than smallStep.
The maximum value of the Slider.
The minimum value of the Slider.
The orientation of a Slider: "horizontal"
or "vertical"
.
Can be used to show (true) or hide (false) the increase and decrease buttons of a Slider.
The small step value of the Slider. Must be a positive number, otherwise an Javascript exception will be thrown.
The small step value determines the amount of Slider value change when the end user
- clicks on the increase or decrease buttons of the Slider;
- presses the arrow keys (the drag handle must be focused);
- drags the drag handle.
Denotes the location of the tick marks in the Slider. The available options are:
- topLeft - Tick marks are located on the top of the horizontal widget or on the left of the vertical widget.
- bottomRight - Tick marks are located on the bottom of the horizontal widget or on the right side of the vertical widget.
- both - Tick marks are located on both sides of the widget.
- none - Tick marks are not visible.
Configuration of the Slider tooltip.
Disables (false) or enables (true) the tooltip of the Slider.
Format string for the text of the tooltip. Note: The applied format will also influence the appearance of the Slider tick labels.
The slider widget supports precision of up-to 10 digits after the decimals point.
<input id="slider" style="width: 300px" />
<script>
$("#slider").kendoSlider({
precision: 4,
smallStep:0.0001,
largeStep:0.0001,
min:0,
max:0.0004,
value: 0.0002,
tooltip: {
format: "{0:#,#.####}"
}
});
</script>
Template of the tooltip. The following variables are passed by the Slider and are ready to be used inside the template:
- value - the current value when using a regular slider
- selectionStart and selectionEnd - the current values when using a range slider
<div id="rangeslider" class="humidity">
<input />
<input />
</div>
<script>
// the following template definitions are identical and represent the default RangeSlider template
var templateString = "#= selectionStart # - #= selectionEnd #";
// or
// var templateString = "# return selectionStart + ' - ' + selectionEnd #";
$("#rangeslider").kendoRangeSlider({
min: 0,
max: 100,
tooltip: {
template: kendo.template(templateString)
}
});
</script>
The underlying value of the Slider.
Prepares the Slider for safe removal from the DOM.
Detaches event handlers and removes data entries in order to avoid memory leaks.
<input id="slider" style="width: 300px" />
<script>
$("#slider").kendoSlider({
precision: 4,
smallStep:0.0001,
largeStep:0.0001,
min:0,
max:0.0004,
value: 0.0002,
tooltip: {
format: "{0:#,#.####}"
}
});
// deatach events
$("#slider").data("kendoSlider").destroy();
// remove slider html from DOM
$("#slider").closest(".k-slider").remove();
</script>
Enable/Disable the Slider widget.
<input id="slider" style="width: 300px" />
<script>
$("#slider").kendoSlider({
precision: 4,
smallStep:0.0001,
largeStep:0.0001,
min:0,
max:0.0004,
value: 0.0002,
tooltip: {
format: "{0:#,#.####}"
}
});
// get a reference to the slider widget
var slider = $("#slider").data("kendoSlider");
// disables the slider
slider.enable(false);
// enables the slider
slider.enable(true);
</script>
The argument, which defines whether to enable/disable the Slider.
Gets/Sets the max value of the Slider.
The max value to set.
Number
The max value of the Slider.
<input id="slider" />
<script>
$("#slider").kendoSlider();
var slider = $("#slider").data("kendoSlider");
var max = slider.max();
console.log(max);
</script>
<input id="slider" />
<script>
$("#slider").kendoSlider();
var slider = $("#slider").data("kendoSlider");
slider.max(20);
</script>
Gets/Sets the min value of the Slider.
The min value to set.
Number
The min value of the Slider.
<input id="slider" />
<script>
$("#slider").kendoSlider();
var slider = $("#slider").data("kendoSlider");
var min = slider.min();
console.log(min);
</script>
<input id="slider" />
<script>
$("#slider").kendoSlider();
var slider = $("#slider").data("kendoSlider");
slider.min(-10);
</script>
Changes the initial Slider configuration.
The new configuration options. It can be used for changing "min", "max", "smallStep" and "largeStep" options of the Slider.
<input id="slider" />
<script>
$("#slider").kendoSlider({
min: -10,
max: 20,
smallStep: 2,
});
var slider = $("#slider").data("kendoSlider");
slider.setOptions({
min: -5,
max: 5,
smallStep: 1,
largeStep: 2
});
</script>
Gets or sets the value of a Slider. It accepts a string or number as parameters and returns a number representing the underlying value.
<input id="slider" style="width: 300px" />
<script>
$("#slider").kendoSlider({
precision: 4,
smallStep:0.0001,
largeStep:0.0001,
min:0,
max:0.0004,
value: 0.0002,
tooltip: {
format: "{0:#,#.####}"
}
});
var slider = $("#slider").data("kendoSlider");
var sliderValue = slider.value();
console.log(sliderValue);
</script>
_optional, default: _
The value to be set for a Slider.
Number
The value of the Slider.
Adjusts the Slider layout to match the size of the container.
<input id="slider" style="width: 200px;" />
<script>
$(document).ready(function() {
$("#slider").kendoSlider();
var slider = $("#slider").getKendoSlider();
slider.wrapper.css("width", "400px");
slider.resize();
});
</script>
Fires when the slider value changes as a result of selecting a new value with the drag handle, buttons or keyboard.
Represents the updated value of the slider.
Fires when the user drags the drag handle to a new position.
Represents the value from the current position of the drag handle.