seiyria / bootstrap-slider

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

single ticks array not work? #861

Closed jonlepage closed 5 years ago

jonlepage commented 5 years ago

it possible to add a single ticks data? On my side it not work, it work only with multi ticks? i want to allow my slider to ticks when near to the default value.

     // create multi sliders light falloff for Coefficient light attenuation
    function create_sliderFallOff(dataValues){
        function upd() { this.asignValues(dataValues, false) };
        const Kc = new Slider("#Kc", { tooltip: 'always', ticks: [0.75], ticks_snap_bounds: 0.1, ticks_labels: ['0.75']});
        const Kl = new Slider("#Kl", { tooltip: 'always'});
        const Kq = new Slider("#Kq", { tooltip: 'always'});

        Kc.tooltip.style.opacity = 1, Kl.tooltip.style.opacity = 1, Kq.tooltip.style.opacity = 1;
        Kc.on("slide", (function(value) { dataValues.falloff[0] = value; upd.call(this) }).bind(this));
        Kl.on("slide", (function(value) { dataValues.falloff[1] = value; upd.call(this) }).bind(this));
        Kq.on("slide", (function(value) { dataValues.falloff[2] = value; upd.call(this) }).bind(this));
    };

as you can see the slider freeze to 0.75 and cannot move! image

thanks guys

seiyria commented 5 years ago

Please provide a jsfiddle

jonlepage commented 5 years ago

@seiyria sure, here and thanks for help https://jsfiddle.net/jonforum/1pkzj92a/16/

edit i update max,min. So as you can see , we are not allow to define a single ticks with also if we add min and max. The idea it to add a custom tiks for easy pin to default value in my context. But i don't need other ticks. I don't know if you understand what i mean.

jonlepage commented 5 years ago

hum, i think a found a easy way. i can maybe add 3 ticks, and with document.querySelectorAll(#slider-tick); add attribute display none to index array 0 and length-1; image

If you don't have alternative , i will proceed with this way. The start and end will tiked , i dont want , but it will be ok if you don't have solution. image

seiyria commented 5 years ago

That was going to be similar to my recommendation. What you want isn't possible currently. Glad we came to the same conclusion!