bootstrap-slider
可以突出显示滑块上的某些范围:
例子:
// With JQuery
$('#ex22').slider({
id: 'slider22',
min: 0,
max: 20,
step: 1,
value: 14,
rangeHighlights: [{ "start": 2, "end": 5, "class": "category1" },
{ "start": 7, "end": 8, "class": "category2" },
{ "start": 17, "end": 19 },
{ "start": 17, "end": 24 },
{ "start": -3, "end": 19 }]});
#slider22 .slider-selection {
background: #81bfde;
}
#slider22 .slider-rangeHighlight {
background: #f70616;
}
#slider22 .slider-rangeHighlight.category1 {
background: #FF9900;
}
#slider22 .slider-rangeHighlight.category2 {
background: #99CC00;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.4.0/css/bootstrap-slider.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.4.0/bootstrap-slider.js"></script>
<input id="ex22" type="text"
data-slider-id="slider22"
data-slider-min="0"
data-slider-max="20"
data-slider-step="1"
data-slider-value="14"
data-slider-rangeHighlights='[{ "start": 2, "end": 5, "class": "category1" },
{ "start": 7, "end": 8, "class": "category2" },
{ "start": 17, "end": 19 },
{ "start": 17, "end": 24 }, //not visible - out of slider range
{ "start": -3, "end": 19 }]' />
(上面代码的jsfiddle:https ://jsfiddle.net/chapkovski/Ljmh7190/ )
是否可以使用 ion.RangeSlider 实现相同的效果?http://ionden.com/a/plugins/ion.rangeSlider/index.html