![](/img/trans.png)
[英]element slider start from 0 to bottom (negative) instead 0 to top in firefox
[英]how start DragDealer slider value from 1 instead of 0
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滑塊。 誰能幫我解決這個問題。
嘗試這樣:
初始化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));
}
});
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.