简体   繁体   中英

Display pip values in Nouislider as number range

I have created a nouislider with this code:

<div id="slider"></div>
<script>
var slider = document.getElementById('slider');
noUiSlider.create(slider, {
    start: 0,
    step: 1,
    tooltips: false,
    connect: 'lower',
    range: {
        min:[559],
            '1%':[559,1],
            '25%':[560,60],
            '50%':[620,55],
            '75%':[675,75],
            '100%':[725],max:[725]
    },
    pips: {
        mode: 'values',
        values: [559,560,620,675,725],
        density: 20 }
       
   
});
</script>

and my pip values appear as,

在此处输入图像描述

but I want it to appear this way: 在此处输入图像描述

Please how can I achieve this? Can I input an HTML value in the pip value or do I have to use jquery?

The pips option accepts a format parameter . You can pass a to function there to format each value as described in the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM