0
I have a slider jquery-ui, it does not have a good behavior in mobile, so I added some buttons plus and Less:
<div class="price">
<div class="small-3 large-3 column" style="margin-top: -10px">
<a class="money-mobile plus min">+</a>
Min
<div id="price-min" class="money-view">0</div>
<a class="money-mobile less min">-</a>
</div>
<div class="small-6 large-6 column slider-money">
<div class="slider" style="background: rgba(65, 65, 65, 0.4); border: 0"></div>
</div>
<div class="small-3 large-3 column" style="margin-top: -10px">
<a class="money-mobile plus max">+</a>
Max
<div id="price-max" class="money-view">1000</div>
<a class="money-mobile less max">-</a>
</div>
</div>
they are working well with the following code in jquery to change the values of the slider:
$(".money-mobile").mousedown(function(){
var slider = $(".slider" );
var values;
var step = slider.slider("option", "step");
var max = slider.slider("option", "max");
var min = slider.slider("option", "min");
//while(enquanto precionado){
values = slider.slider("option", "values");
if($(this).hasClass('max')){
if($(this).hasClass('plus')){
if(values[1] + step <= max){
slider.slider({values: [values[0], values[1] + step]});
}
}else if($(this).hasClass('less')){
if(values[1] - step >= min) {
slider.slider({values: [values[0], values[1] - step]});
}
}
}if($(this).hasClass('min')){
if($(this).hasClass('plus')){
if(values[0] + step <= max) {
slider.slider({values: [values[0] + step, values[1]]});
}
}else if($(this).hasClass('less')){
if(values[0] - step >= min) {
slider.slider({values: [values[0] - step, values[1]]});
}
}
}
values = slider.slider("option", "values");
$("#price-min").text(values[0]);
$("#price-max").text(values[1]);
//} até aqui
}).mouseup(function(){
search();
});
but this code only works with a first click. What I wanted to do is as long as the button keeps pressing it keeps changing Silder.
Does anyone know how to do that? can give me a strength, Please.