jQRangeSlider
jQRangeSlider copied to clipboard
Allow passing options object to existing rangeSlider to update several values at once
for example:
$('.my-slider').rangeSlider('options', {
arrows: false,
step: { months: 3 },
range: { min: {months: 3} }
});
Is there a simple way to do this that doesn't involve iterating like this:
_.each(options, function(val, key){
$('.my-slider').rangeSlider('option', key, val);
})
Sure, you can do this. It is not described clearly in the docs, but it works. This feature is supported by the jquery-ui widget, from which the slider is inheriting.
All you have to do is to call "option" (without an "s") and pass an object.
$('.my-slider').rangeSlider('option', {
arrows: false,
step: { months: 3 },
range: { min: {months: 3} }
});
Is there a way to do this for values as well?
Does not work (only bounds are updated):
$('#time-control').dateRangeSlider('option', {
bounds: {min: sod, max: eod},
values: {min: selMin, max: selMax}
});
This works, updates both bounds and values (but this triggers the valuesChanged event twice):
$('#time-control').dateRangeSlider('bounds', sod, eod);
$('#time-control').dateRangeSlider('values', selMin, selMax);
I've tried using 'defaultValues' when setting options, but that doesn't work either.