Jquery Slider Initial Spacing

In this simple code, the slider does not slide to the desired point (it should be 14 + 12 or 26). Instead, it slides to 24.

$("#slider").slider({
range: "min",
min: 0,
max: 100,
step: 12,
value: 14,
slide: function( event, ui ) {
    $("#slider-value").text( ui.value );
};

      

});

Tell me: http://jsfiddle.net/slandmann/conyyam1/12/

+3


source to share


3 answers


"Error" is in the meaning min

. Basically, you can't get value

(14) s step

out of 12 from your min

(0), it's just simple math. To fix this, you need to install another step

(2, 7 or 14) or set min

to 2.



+2


source


It looks to me like you are trying to get it to jump to a point that is not allowed.



You have identified a step 12

. Therefore, the slider should never reach a point that is not a multiple 12

. If you want to set it to 26

, then you need a finer step that allows this value.

0


source


You requested 12 steps, so I expect the value to be bound to multiples of 12 (12, 24, 36, 48 ...). In this case, the values ​​14 and 26 are invalid.

0


source







All Articles