西瓜,调试出来了,应该是修改jquery.range.js中的
onDragEnd: function(e) {
this.pointers.removeClass('focused');
this.labels.removeClass('focused');
$(document).off('.slider');
//鼠标移开后的动作
alert(this.options.value);
},
可以在初始的时候定义个onstatechange方法,把拖动结果输出来
$(".single-slider").each(function() {
var num = $(this).attr('num');
var input = $("#" + $(this).attr("outputId"));
$(this).jRange({
onstatechange: function() {
input.val(this.options.value)
},
from: 0,
to: num,
step: 1,
format: '%s',
width: 200,
showLabels: true,
showScale: true
});
});在这个位置试试jquery.range.js中onDrag: function(pointer, e)中
onDrag: function(pointer, e) {
e.stopPropagation();
e.preventDefault();
if (e.originalEvent.touches && e.originalEvent.touches.length) {
e = e.originalEvent.touches[0];
} else if (e.originalEvent.changedTouches && e.originalEvent.changedTouches.length) {
e = e.originalEvent.changedTouches[0];
}
var position = e.clientX - this.domNode.offset().left;
this.domNode.trigger('change', [this, pointer, position]);
alert(position);
},
回复
你好,如何更改为 拖动滚动条 松开鼠标即 读取 滚动条的 区间值呢?