I have seen some examples of what I need, but nothing responds to what I need.
I am changing the value of two elements using the ui.values slider. The difference between these values ββcannot be less than "2".
So I used a quick formula unless (xy <2) change another change. But if the difference is less than "2", then the sliders are still moving. Anyway, to stop this?
var sstart = $("#slidestart").text() var send = $("#slideend").text() $('#dateSlider').slider({ range: true, min: 1, minRange: 2, max: 14, step: 1, values: [ sstart, send ], slide: function( event, ui ) { if(ui.values[1] - ui.values[0] < 2){ // do not allow change alert("that is naughty"); } else { // allow change $("#slidestart").text(ui.values[0]) $("#slideend").text(ui.values[1]) } } });
Thank you: Great result.
return false;
JS BIN EDIT
jquery slider
goingsideways
source share