seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

Feture request: a slider that allows outer min/max values #894

Closed robsch closed 5 years ago

robsch commented 5 years ago

I would like to show a slider with values from 0 to 100. However, the user should only be able to choose values between 20 and 80. So min/max would be 20/80. Then there are ranges from 0 to 19 and 81 to 100 where one cannot put the handle to (not to be confused with the default meaning of 'range' with this control).

Ideally there should be configuration settings like outerMin/outerMax. Shouldn't be too hard to implement, I guess. What do you think?

What would be a workaround for now? Checking and canceling slider events?

seiyria commented 5 years ago

You could already do this by blocking the event that changes the slider, and this is the way I would recommend doing this.

jespirit commented 5 years ago

Here's an example of how you can do it.

https://jsfiddle.net/g64m7r9s/

robsch commented 5 years ago

The event blocking is actually sufficient.

@jespirit Thank you for this example!