我得到 2 个相同的滑块重叠。我只想要 1 个滑块。
不知道如何实现这个插件。有人成功使用过吗?
网络文档片段:
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<!-- seiyria-bootstrap-slider Plugin -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/css/bootstrap-slider.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/bootstrap-slider.min.js"></script>
</head>
<body>
...
<style> /* 2017-02-21 override to fix styling issues with plugin */
div#fixBootstrapSliderPluginStyles div.slider.slider-horizontal { margin-bottom: 20px !important; }
div#fixBootstrapSliderPluginStyles div.slider.slider-horizontal div.slider-tick-label-container { margin-left: -52.5px !important; }
div#fixBootstrapSliderPluginStyles div.slider.slider-horizontal div.slider-tick-label-container div.slider-tick-label { width: 105px !important; }
</style>
<script> // https://github.com/seiyria/bootstrap-slider
var values = ['None', 'Read', 'Speak'];
var formatter = (index) => values[index];
</script>
<!-- Slider (default "English") -->
<div class="form-group" id="fixBootstrapSliderPluginStyles">
<label class="col-md-4 control-label" for="language_english">English</label>
<div class="col-md-4">
<input id="language_english" type="text" data-provide="slider"
data-slider-ticks="[0, 1, 2]"
data-slider-ticks-labels='["None", "Read", "Speak"]'
data-slider-min="0"
data-slider-max="2"
data-slider-step="1"
data-slider-value="2"
data-slider-tooltip="show"
/>
</div>
</div>
<script>
new Slider( '#language_english', {formatter} );
</script>
...
</body>
</html>
我的 jsFiddle: https ://jsfiddle.net/kretrjgz/