如何从1而不是0启动DragDealer滑块值

how start DragDealer slider value from 1 instead of 0

本文关键字:DragDealer 启动      更新时间:2023-09-26

HTML代码IS:

<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="answerswer[]" 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开始。我用过dragdowner滑块。有人能帮我解决这个问题吗。

这样尝试:

speed之前初始化x: 1,

$(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));
    }
});
})