Nick Nick - 1 year ago 107
jQuery Question

roundSlider plugin - unable to get starting value

I'm working on a project where i need to use this roundSlider plugin:

And i'm trying to change the color of the track(

) with the value of the slider when it's created.

Basically, i'd like to use it so that it goes from green, to yellow, to red according to the value and appends a class (
) to

I have it working on change event, but i'm not able to figure out how to get the start value.
I'm using this as an angular directive in my project.

Here's a quick example:,css,output

Also, i checked the console and i'm actually adding tons of classes, not only the one that i need..

Thanks a lot for any help

Answer Source

I actually managed to solve this myself, here's how if other people is interested:,output

i created a setColor() function

function setColor(value){
        var el = $('.rs-range-color');
                    var tempValue = parseInt(value);
                    el.addClass('speed-' + tempValue);

passing the value as a parameter, and then calling it on change event and on create event.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download