IonDen / ion.rangeSlider

jQuery only range slider
http://ionden.com/a/plugins/ion.rangeSlider/en.html
MIT License
2.56k stars 508 forks source link

Checking whether a slider is disabled #727

Closed recifx closed 4 years ago

recifx commented 4 years ago

Thanks for making this project available.

I would like to read the from and to values of a slider when disable is false. As a test I tried

var $irs1 = $(".irs1");
$irs1.ionRangeSlider({
  skin: "round", type: "double", min: 0, max: 1000, from: 200, to: 500, grid: true, disable:false};
var $irs2 = $(".irs2");
$irs2.ionRangeSlider({
  skin: "round", type: "double", min: 0, max: 1000, from: 100, to: 600, grid: true, disable:true};
let my_irs1 = $irs1.data("ionRangeSlider");
let my_irs2 = $irs2.data("ionRangeSlider");
console.log($irs2.data().from);        // returns   '100' as expected
console.log($irs2.data().disable);   // returns 'undefined'

Is there a different approach to checking if a slider is disabled?

I also had an issue that my_irs2.reset() did not reset the slider to a disabled state after I had toggled it on. I was able to get around that by explicitly including a call my_irs2.update({disable: true});

Thanks in advance for any assistance in resolving this issue.

IonDen commented 4 years ago

Hi, possible work around would be store disabled state in the external variable and change it too, every time you toggle sliders disable param.

reset() method just move handles back to original position, it will not work after you used update() to toggle slider.

recifx commented 4 years ago

Thanks for responding. Checking the toggle variable rather than the instance variable works for my purposes.