i want jquery slide range in RTL
To create a jQuery slide range in RTL (right-to-left) direction, you can use the following code:
HTML:
<div id="slider"></div>
JavaScript:
$(function() {
$("#slider").slider({
range: true,
min: 0,
max: 100,
values: [20, 80],
direction: "rtl", // set direction to RTL
slide: function(event, ui) {
$("#amount").val(ui.values[0] + " - " + ui.values[1]);
}
});
$("#amount").val($("#slider").slider("values", 0) +
" - " + $("#slider").slider("values", 1));
});
CSS:
/* For RTL direction */
.ui-slider-horizontal {
direction: rtl;
}
.ui-slider-range {
right: auto !important;
left: 0 !important;
}
.ui-slider-handle {
right: auto !important;
left: 0 !important;
}
In this code, we used the direction property to set the slider direction to RTL. We also added some CSS styles to adjust the slider handles and range to the RTL direction.
原文地址: https://www.cveoy.top/t/topic/bNQN 著作权归作者所有。请勿转载和采集!