Suffii
Suffii

Reputation: 5784

Issue on Adding Steps to jQuery UI Slider

I am trying to add For steps and Value to jQuery UI Slider at This Demo to be look like this image enter image description here

so I have 4 steps and he slider handler ONLY sits on one of those values(Not Between) I already tried this methis form jQuery UI documentation

$( "#slider" ).slider({ step: 4 });
var step = $( "#slider" ).slider( "option", "step" );
$( "#slider" ).slider( "option", "step", 4 );

but it didn't work I also tried

$(function() {
    $( "#slider" ).slider({  range: "min",
    min: 1000,
    max: 7000,
    value: 1000});
  }); 

again no success! can you please let me know how I can achieve this? Thanks

Upvotes: 1

Views: 430

Answers (1)

j08691
j08691

Reputation: 207881

Your step option setting should be the difference between values, not the number of steps:

$(function () {
    $("#slider").slider({
        range: "min",
        min: 1000,
        max: 7000,
        value: 1000,
        step:2000
    });
});

jsFiddle example

Upvotes: 2

Related Questions