0

I have a basic jQuery UI slider that allows the user to move the slider and a related textbox updates with the value.

I am trying to make it so that when a user changes the textbox value, the slider will move to the correct value. I believe the problem I am having is related to the non-linear values this slider requires, although it might not actually be the reason for the incorrect movements in the jsFiddle example.

I have tried e.g

$("#slider").slider("option","value",4);

but this doesn't update to the correct position.

Any help would be greatly appreciated.

http://jsfiddle.net/kfzZ8/3/

4

1 回答 1

1

You would want to use the index of your sizeArray:

var position = sizeArray.indexOf(parseInt($('#tbSize').val()));
$("#slider").slider("option","value", position);

http://jsfiddle.net/nm2gs/

于 2013-11-12T12:12:06.237 回答