New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Positive/negative colored slider #371
Comments
Yes, it can. Using the slide event, you can check the current slider value to see if it's negative or not and change the background color of the slider accordingly. |
Thanks for looking into this! |
It appears the current markup of the slider does not allow for coloring an exact portion of the slider (i.e. starting in the middle and going all the way right or left). I suppose you could hack the generated HTML of the slider and add a div that starts at 50% and goes left or right, then change the color of that div when the slide event fires. |
I'm trying to create the same type of slider and after studying the docs, I still don't understand what you mean by using the
I know this question is a bit old but could you please elaborate a bit further on how |
You can pretty much disregard the previous answer, it doesn't apply anymore since the structure of the slider changed a bit to support transforms. Basically, what I'd do to solve this issue:
I'd be happy to help if you set up a basic fiddle. |
Yep, that's pretty much what I ended up doing last night: Any chance you could add this type of feature in a future release though? Doesn't feel right hacking it up this way, if you know what I mean. Great library, btw! Thanks so much! EDIT: To anyone looking at the above fiddle, please don't use that in production code. The code there is for prototypical purposes only. I mean, you can ... but probably shouldn't. |
@iplaksiy What API would you propose? |
@leongersen I’m on deadline at the moment, but I should free up in the next couple of days and can take a look then. I have some ideas in my head on how to go about doing it, I’ll just need to flush them out a bit once I get some time. |
I gave it a try too, and I got to a result using only one element and the https://jsfiddle.net/leongersen/9hyfv0bw/6/ If this fits your requirements, I'll go ahead and add this example to the docs. |
Nice! Love the approach! The bg fill while dragging is perfect, however, I just forked your version to see if we could apply the same fluid experience when tapping. In your version, the fill reaches it's destination faster than the handle when tapping. |
You can set |
I'll complete the example and add it to the documentation. |
Hi @leongersen, may I ask if it's already implemented in the current version? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I would like to make a slider that can deliver positive and negative values and I would like the slider color to change accordingly, like this:
can this be done with the current version of noUiSlider?
The text was updated successfully, but these errors were encountered: