JQuery Slider, how to make “step” size change

后端 未结 12 776
遥遥无期
遥遥无期 2020-11-27 10:59

Is it possible to use the JQuery Slider (range slider / dual slider) to have non-linear (non consistent \"step\" size) values?

I want to horizontal Slider to look li

12条回答
  •  自闭症患者
    2020-11-27 11:11

    Based on the above answer and discussion from @Seburdis, and using the names from your example:

    var prices_array = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 500, 1000, 1500, 2000, 2500, 5000, 10000];
    
    function imSliding(event,ui)
    {
        //update the amount by fetching the value in the value_array at index ui.value
        $('#amount').val('$' + prices_arr[ui.value] + ' - $' + prices_arr[prices_arr.length - 1]); 
    }
    
    $('#slider-interval').slider({ min:0, max:values_arr.length - 1, slide: imSliding});
    

提交回复
热议问题