Answers for "how to reset ion range slider"

0

how to reset ion range slider

var $d5 = $("#demo_5");
    var $d5_buttons = $(".js-btn__d5");
    $d5.ionRangeSlider({
        skin: "big",
        type: "double",
        min: 0,
        max: 10,
        from: 4,
        to: 6,
        grid: true,
        step: 2
    });
    
    var d5_instance = $d5.data("ionRangeSlider");
    $d5_buttons.on("click", function () {
        var min = rand(0, 1000);
        var from = rand(min, min + 2000);
        var to = rand(from, from + 5000);
        var max = rand(to, to + 2000);
        var num = rand(4, 15);
        var step = rand(1, 100);
    
        d5_instance.update({
            min: min,
            max: max,
            from: from,
            to: to,
            grid_num: num,
            step: step
        });
    });
    
    function rand (min, max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
Posted by: Guest on June-17-2020

Browse Popular Code Answers by Language