问题
I want to create generic jquery ui slider so that if i pass any number,it should return me that number of interconnected sliders.
If I slide any 1 slider,it should change others.However, the sum of all the sliders must always be 100 at any point of time.
I tried it myself which is working but as soon as the value of slider goes more than 50 and you try to increase the other slider then the total sum of all the sliders becomes greater than 100.
Here is the link of my code.
Can anyone help me please? thanks'
回答1:
ahah you've taken my ugly css for your jsfiddle. I try to do exactly the same thing, look at this: 3 jquery ui slider connected
回答2:
I've done this for a client project and open sourced my solution. It uses noUiSlider instead of jQuery UI Sliders, but if you wanted to modify it, it would not be too difficult. It's not completely polished up yet and I realize this question is a year old, but just in case anyone wants it:
Github: jQuery Interconnected Sliders
It supports locks (which allows you to set a value and then not move it again) and it looks something like this: screenshot
来源:https://stackoverflow.com/questions/10262003/jquery-interconnected-slider