Reputation: 743
I have code like below
<script>
$(function() {
$( "#slider-range" ).slider({
range: true,
min: 0.6,
max: 300,
values: [ 0.6, 300 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
alert('300');alert(ui.values[ 1 ]);
$("#min_price").val(ui.values[ 0 ]);
$("#max_price").val(ui.values[ 1 ]);
},
stop: function( event, ui ) {
get_filter_result();
}
});
$( "#amount" ).val("$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + 300);
});
</script>
the actual min value is 0.6 and max value is 117.. but when slider is created the range is shown from 0.6 to 116.6 I have noticed 1 thing it takes similar decimal value as in minimum.. means if min value is 15.8 then max value will be .8 after decimal..
Upvotes: 0
Views: 137
Reputation: 129812
I assume you're using jQuery UI slider?
This slider accepts an option called step
which sets the discrete intervals between min
and max
. The default value is 1
, meaning each step to the right in the slider increases the value by 1, which is probably what you are seeing.
If you want 0.6
to be a possible value, but also 1
, for instance, you will need to set step
to a value that encompasses both those values, such as 0.1
or 0.2
.
min: 0.6,
max: 300,
step: 0.1,
Upvotes: 1