How to disable/enable exists slider?
DNizovtsev opened this issue · 4 comments
DNizovtsev commented
Hi
How to disable/enable exists slider?
Thanks
abpetkov commented
Could you please explain in better english, I'm not sure what your question is?
Disabling a slider is done via the disable
property, you can find an example in the demo page.
DNizovtsev commented
I mean how I can disable slider(after some event) then enable slider(after other event)? not just create disabled slider.
Thanks.
abpetkov commented
You can't do that currently, since disabling is handled on creating the slider instance only. I will consider including this in the next version.
rifi commented
I found way.
I was added small function in original source(powerange.js)
- not minified
Powerange.prototype.setDisabled=function(flag){
if(flag){
this.options.disable = true;
this.disable();
} else {
this.options.disable = false;
this.bindEvents();
this.slider.style.opacity=1;
classes(this.handle).remove("range-disabled");
}
}
- minified
n.prototype.setDisabled=function(flag){
if(flag){
this.options.disable = true,
this.disable()
} else {
this.options.disable = false,
this.bindEvents(),
this.slider.style.opacity=1,
a(this.handle).remove("range-disabled")
}
}
When you need, just call function setDisabled
var elem = document.querySelector('.js-range');
var init = new Powerange(elem);
init.setDisabled(true);
init.setDisabled(false);
Thank you @abpetkov. I really appreciate your kind library.