JQuery: How to Redraw Slider?
Question
I need your help desperately since I spent too much time trying to modify Jquery Slider Plugin with no success.
I am using this slider plugin: http://blog.egorkhmelev.com/2010/03/jquery-slider-update/
What I am trying to do is to re-draw this JQuery Slider on click. When user clicks - new settings with new scale and pointer positions are passed. Redraw works only partially, changing only one pointer position and scale. I must have missed something in the code or do not have enough Jquery knowledge to solve this problem.
Please note: Redraw is not yet implemented in this plugin, its a new feature I am trying to add.
A lot of people have asked the same question on official website but it seems that there is no support anymore. So if you could help me to find a bug - I promise to share this solution on the web again.
Thank you a lot! Kelvin
Solution
Try this code:
/* -------- REDRAW SLIDER CODE -------- */
case "redraw":
//self.domNode.remove(); // remove slider
self.domNode.remove(); // remove slider
if (isDefAndNotNull(args[1])) {
$.extend(true, self.settings, args[1]);
self.settings.interval = self.settings.to - self.settings.from; //calculate new interval
self.settings.value = self.inputNode.attr("value"); // set new pointers position
self.is = {
init: false
};
self.o = {};
}
self.create(); // re-create slider with new settings
break;
/* -------- END OF REDRAW SLIDER CODE -------- */
I just added code to clear out some internal state self.is.init
and self.o
.
Example here: