Richard
Richard

Reputation: 32929

jQuery slider: show values that are multiples of 10?

I'm using the jQuery ui slider, set up as follows:

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

It works pretty well, but the range is set by default to every natural number - so when sliding I get values such as 61-403.

Anyone know how to set it so the values increase in multiples of 10, say? So values such as 60-400? This would work a lot better for a price slider.

Thanks.

Upvotes: 0

Views: 448

Answers (3)

swatkins
swatkins

Reputation: 13640

use the step property:

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

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

Upvotes: 0

Christofer Eliasson
Christofer Eliasson

Reputation: 33865

It sounds like you are looking for the step option:

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

Upvotes: 1

graphicdivine
graphicdivine

Reputation: 11211

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

Upvotes: 0

Related Questions