I have a web app that uses a lot of jQuery sliders. All are bound to input elements with the function below. This is working very nicely except on the iPhone. From what I've seen so far in discussions here and elsewhere there are no good solutions currently available to make the sliders work nicely.
As a workaround, I want to bind a repeating action to '-' and '+' imgs I've placed at either end of the sliders. What's the cleanest way to incorporate this into my sliderinit() function so that holding a finger (or mouse) over the img will increment the input element $(inpid) value, the slider label $(sldlblid) and update the slider thumb in real time?
Note that the values are floats and must be constrained to min and max values supplied in the function argument.
function sliderinit(inpid,min,max) {
var sldid = '#slider_'+inpid;
var sldlblid = sldid + "_val"
inpid = '#'+inpid;
$(inpid).hide();
$(sldid).slider(
{
min: min,
max: max,
step: (max-min)/100.,
value: $(inpid).val(),
stop: function(event,ui) {
$(inpid).val(ui.value);
$(sldlblid).text((ui.value).toFixed(2));
}
});
};
Thanks, Mike