简体   繁体   中英

Set new value for nouislider is reached max number

Good day,

Is it possible to set a predefined string value to this if the slider reached maximum value of 2000.

Here's my code

 noUiSlider.create(connectSlider, { start: 300, step: 5, connect: 'lower', range: { 'min': 0, 'max': 2000 }, format: wNumb({ decimals: 0, thousand: ',', prefix: '$', postfix: ' per month', }), });

http://refreshless.com/nouislider/slider-options/

Thanks

You can use the edit function in the formatter. It runs after all other formatting options are applied.

format: wNumb({
    decimals: 0,
    thousand: ',',
    prefix: '$',
    postfix: ' per month',
    edit: function ( value ) {
        return value == yourMaxValue ? 'Maximum reached!' : value;
    }
})

For reference: all formatting options .

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