Is possible to have a discrete slider input?

Hello!

Im wondering if there is a way to implement a slider input where the values are discrete, and not necessary with the same distance between them.

For example: 1, 2, 5, 7, 15.

And also, if those values can be set up with dinamyc data.

Anyone knows how to do it? I couldnt find anything about this.

If not, I leave it as an idea for anyone who knows how to do it.

Thanks for your help.

Im answering myself… but I would like to hear if there is something more efficient.

A way to achieve this is by relating the chosen value from the slider input, to the value we want.

Example:

Slider value - Descrete value needed
0 - 1
1 - 2
2 - 5
3 - 7
4 - 15

That’s also what I would suggest since sliders can only increase by equal steps. If you know a little of javascript, you could have an array of desired values [1, 23, 84, 234, 123214] and use array indexes to match the values.
You slider should start at 0 (since the first element’s index in array is 0) and have it to increment by 1. The maximum value of the slider should be the number of element in your array minus 1 (again, since indexing starts at 0).

This topic was automatically closed after 70 days. New replies are no longer allowed.