Jens Törnell
Jens Törnell

Reputation: 24768

nouislider custom steps with single drag

I try to add custom steps to nouislider but with no luck.

The slider moves from 500 to 10000 and misses 1000.

$("#nouislider").noUiSlider({
    start: 500,
    snap: true,
    range: {
        'min': [500],
        '1000': [1000],
        'max': [10000],
    },
 });

Did not work, same thing

$("#nouislider").noUiSlider({
    start: 500,
    snap: true,
    range: {
        'min': 500,
        '1000': 1000,
        'max': 10000,
    },
 });

Upvotes: 1

Views: 1216

Answers (1)

Lg102
Lg102

Reputation: 4898

The keys in the range option indicate where you want the value to be on the range. If you want it half-way:

$("#nouislider").noUiSlider({
    start: 500,
    snap: true,
    range: {
        'min': 500,
        '50%': 1000, // Note the percentage indicated here.
        'max': 10000
    }
});

Upvotes: 1

Related Questions