What is happening here is that, the onUpdate
event destroys/removes the whole slider from the dom and creates a new slider with the new values(updated ones). I am assuming, you are capturing the new values from some input mechanism, e.g. the user enters the price in an input field and presses submit, which you then use to update the slider with.
Now there are a few ways we can achieve what you want. One, edit the plugin js files itself, but that's a lot of work and we don't get the free cdn they provide. Two, update the slider with old values and then manually change the slider positioning with js. Third, forget about the onUpdate
event and create your own CustomeUpdate
event. So...
$("#input").click(function(){
//$("#ion-slider").update(); Don't do this!!!
$("#ion-slider").trigger("customUpdate"); //Do this instead
})
$("#input").on( "customUpdate", function(){
var calib = "someNumericInputWidthRatio"; //put a value like 34
var newWidth = calib*$("input").value();
$("irs-bar.irs-bar--single").width(newWidth); //this will transition smoothly if you have transitions in css
$(".irs-handle.single").left(newWidth+15); // 15 is half width of the
draggable circle
})
Add "px" to the numeric widths as you need, as I have been a bit lousy. My point is to just get the idea across with jquerish pseudo code.