I have problem with range slider. I want only this values: 1, 3, 5, 10, but my script isn't working good.
$(function(){
$('#boga').on('input',function(){
var hodnota=$(this).val();
if(hodnota<=5)
$(this).attr("step","2");
else {
$(this).attr("step","5");
}
});
});
var max = 10,
min = 1,
step = 1,
output = $('#output').text(min);
$(".range-slider")
.attr({'max': max, 'min':min, 'step': step,'value': String(min)})
.on('input change', function() {
output.text(this.value);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<output id="output"></output>
<input id="boga" class="range-slider" type="range">
I tried to replace "5" in else with "9", it's working but slider jumps to 1 and after to 10.