2016-05-04 56 views
2

HTML代码开始DragDealer滑块值:如何从1而不是0

<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

尝试这样的:

初始化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)); 
    } 
}); 
}) 
+0

嗨,它不工作..它仍然盯着0 –

+0

@JyotiRawat,你可以发布的HTML代码? –

+0

我已更新HTML代码.. –