点击按钮
时,有什么办法可以停止拖动吗
文档没有给出正确的描述
http://www.eyecon.ro/bootstrap-slider/
$("#stopDrag").click(function(){
});
最佳答案
使用启用和禁用功能扩展 slider 插件,例如:
<script src="/slider/js/bootstrap-slider.js"></script>
<script>
$.fn.slider.Constructor.prototype.disable = function () {
this.picker.off();
}
$.fn.slider.Constructor.prototype.enable = function () {
if (this.touchCapable) {
// Touch: Bind touch events:
this.picker.on({
touchstart: $.proxy(this.mousedown, this)
});
} else {
this.picker.on({
mousedown: $.proxy(this.mousedown, this)
});
}
}
</script>
示例 html:
<div class="container" style="background-color:darkblue;">
<br>
<input id="slide" type="text" class="span2" value="" data-slider-min="-20" data-slider-max="20" data-slider-step="1" data-slider-value="-14" data-slider-orientation="vertical" data-slider-selection="after">
<button id="enable">Enable</button>
<button id="disable">Disable</button>
</div>
示例 javascript:
$('#slide').slider();
$('#enable').click(function(){ $('#slide').slider('enable') });
$('#disable').click(function(){ $('#slide').slider('disable') });
关于javascript - 如何禁用 bootstrap-slider.js 中的 slider ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19027749/