HTML代码是:
<div id="notary-slider" class="dragdealer">
<ul class="list_wrapper">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
<div class="handle red-bar">
<span class="value"></span>
</div>
<input type="hidden" name="answer[]" id="no-of-documents" required>
</div>
$(function() {
new Dragdealer('notary-slider', {
speed: 1,
loose: true,
steps: 10,
animationCallback: function(x, y) {
$('#notary-slider .value').text(Math.round(x * 10));
$("#no-of-documents").val(Math.round(x * 10));
}
});
})
在这个js中,滑块的值是从0到10打印,但我希望滑块值从1到10开始。我使用了dragdealer滑块。任何人都可以帮我解决这个问题。
答案 0 :(得分:0)
试试这样:
在x: 1,
之前初始化speed
。
$(function() {
new Dragdealer('notary-slider', {
x: 1,
speed: 1,
loose: true,
steps: 10,
animationCallback: function(x, y) {
$('#notary-slider .value').text(Math.round(x * 10));
$("#no-of-documents").val(Math.round(x * 10));
}
});
})