jQuery slider:显示10的倍数



我使用jQuery ui滑块,设置如下:

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

它工作得很好,但默认情况下范围被设置为每个自然数-所以当滑动时,我得到的值如61-403。

有人知道如何设置它,使值以10的倍数增加吗?那么60-400这样的值呢?这对于价格滑块来说会好得多。

谢谢。

听起来您正在寻找步骤选项:

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

使用step属性:

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

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

使用step选项。http://jqueryui.com/demos/slider/option-step

最新更新