2011-12-15 109 views
0

我使用jQuery ui slider,设置如下:jQuery滑块:显示10的倍数值?

$("#unicornSlider").slider({ 
    range: true, 
    min: 0, 
    max: 500, 
    values: [0, 500] 
    }); 

它工作得很好,但幅度被默认设置为每自然数 - 所以滑动时,我得到的值,如61-403。

任何人都知道如何设置它,以便在10的倍数值增加,说什么?所以值如60-400?这对于价格滑块会更好。

谢谢。

回答

0

使用step属性:

http://jqueryui.com/demos/slider/#option-step

$("#unicornSlider").slider({ 
    range: true, 
    min: 0, 
    max: 500, 
    step: 10, 
    values: [0, 500] 
}); 
+0

我可以给不同范围不同的动作呢?例如10代表[0-200]和100代表[201 - 500]?在一个单一的滑块? – 2012-09-20 06:55:43

1

这听起来像你正在寻找步骤选项:

$("#unicornSlider").slider({ 
    range: true, 
    min: 0, 
    max: 500, 
    values: [0, 500], 
    step: 10 
    });