omni-slider
omni-slider copied to clipboard
slider init with 0 issue
there is an issue with how the slider is initialized
let say that I want to initialize it with the following:
{ min: 0, max: 2018, start: 0, end: 0, overlap: true };
to have right and left handles set to min.
with the following snippet taken from init method that's not possible:
// Default start/end this.options.start = this.options.start || this.options.min; this.options.end = this.options.end || this.options.max;
this will set this.options start to 0 and end to 2018
the same is true with 'move' method
what if I would like to move hadle to 0?
I cant because of this check:
if (importedData.right) { if (importedData.right < this.options.min) importedData.right = this.options.min; if (importedData.right > this.options.max) importedData.right = this.options.max;
var posRight = (this.options.max - importedData.right) / total * 100;
this.UI.handleRight.style.right = posRight + '%';
this.UI.fill.style.right = posRight + '%';
}
A slider that can't handle 0 as either start or end values. :( I have to work around this by checking for strict equality to 0, and if true, set to the string literal "0" which is truthy but still works as 0 in calculations