tyleryasaka/semantic-ui-range

Setting value of the slider.

nilsi opened this issue · 3 comments

nilsi commented

Hi,

Thanks for a great addition to Semantic UI.
Is there a way to dynamically change the value of the slider? I would like to animate 10 pixels per second until the user grabs the slider. After the user release the slider it will start auto sliding again.

Edit: I could re instantiate the slider over and over but not sure thats a good way.

$('#my-range').range({ min: 0, max: 10, start: 5 });

@nilsi I agree, that would be a hack and not the best way to set the value.

I just updated the code so that you can now set the value like so:

$('#range').range('setValue', 17); // Sets slider with id 'range' to value 17

I have documented this in readme as well.

Thanks!

nilsi commented

Thanks a lot! Works great. A small feedback would be to change it to $('#range').range('set value', 17); since that is more Semantic-ish. :) Closing this.

@nilsi Thanks for pointing that out! I changed the query to set value.