Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable/enable exists slider? #3

Open
DNizovtsev opened this issue Apr 13, 2014 · 4 comments
Open

How to disable/enable exists slider? #3

DNizovtsev opened this issue Apr 13, 2014 · 4 comments

Comments

@DNizovtsev
Copy link

Hi

How to disable/enable exists slider?

Thanks

@abpetkov
Copy link
Owner

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
Copy link
Author

I mean how I can disable slider(after some event) then enable slider(after other event)? not just create disabled slider.

Thanks.

@abpetkov
Copy link
Owner

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
Copy link

rifi commented Jun 5, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants