seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
2.99k stars 1.14k forks source link

bug to set the data-slider-value #785

Closed Abdias-Wang closed 5 years ago

Abdias-Wang commented 7 years ago

Issue: when set the data-slider-value = 0, it will reference to the options.value, which is default 5. need to add a check before setting this.value:

           if ( this.element.data('slider-value') == '0'){
        this.value = this.element.data('slider-value');
    }
    else {
        this.value = this.element.data('slider-value')||options.value;
    }
seiyria commented 7 years ago

A better solution would be to check if the parseint === 0 instead of coercing it and checking again string 0.

Anyway, an alternative is to set it up with js instead of html. You're welcome to submit a PR to address this behaviour though.

jespirit commented 5 years ago

Works.

See https://jsfiddle.net/57rv6a3d/