<link rel="stylesheet" href="./css/jquery.range.css">
<div class="ip-son">
<div class="demo">
<input type="hidden" class="single-slider3" value="0"/>
<div class="demo-son2">
<input type="text" class="ipgs" value="0">
</div>
</div>
</div>
<script src="./js/jquery.range.js"></script>
var test;
//ip個數
test = $('.single-slider3').jRange({
//滑塊滑動時 觸發的函數
onstatechange: function () {
$('.ipgs').val($('.single-slider3').val());
},
from: 0,//最小值
to: 1000,//最大值
step: 20,//步進
//這里改變值
scale: [0, 250, 500, 750, 1000],
format: '%s',
width: 500,//總寬度
showLabels: true,
showScale: true
});
$(".ipgs").blur(function () {
test.setValue( $(this).val());//能綁定滑塊的變化
});
這里是設置函數綁定滑塊的變化
return result || this 改成return result || this.data('plugin_' + pluginName);