- Solved -
I know that they exist, but I have not found a slider that can easily satisfy some basic needs, and I am sure that I am not the only one who is disappointed with this problem. This is what I still have. Am I heading in the right direction?
What am I trying to do:
Using the jQuery UI slider, I need several sliders per page. Each slider will have a minimum of 0, dynamic max and dynamic default value. I set these values ββin an input field with html elements min, max, value and retrieve them later through javascript / jquery.
In addition to their individual maximum values, there should also be a total maximum value, which the sum of all sliders cannot exceed. Finally, I also need accessibility to update the slider from the input window (as well as the slider itself).
What I have so far:
After exploring a number of sliders, I settled on using the JQuery UI slider and eventually came across this post, which made me start by achieving my goals: Combined summary for several jQuery-UI Sliders
I changed the code to (1) Use a hidden input field to get the total maximum value; (2) fills the input text field instead of the range with the current value; (3) set the initial maximum value of an individual slider from the attribute max =; (4) set the slider to disabled: true if the initial max is 0; and (5) listen to the changes in the text box and move the slider according to the entered number, if it does not exceed the maximum value.
Current code (JSFiddle): (see jsfiddle in the answer)
(Slider # 1 Starting max is 0 - disabled // Other sliders have a maximum of 500 // general table max 1000)
What the slider works:
- It is highly customizable and is under full maximum limit.
- Correctly sets the initial individual max and total maximum
- Sets and remains disabled if max is 0
- The slides are correct when you change the text box
I need help / fix ideas:
- Changing the sliders tends to change the individual slider max = total maximum
- Changing the text field correctly displays the current strip, but does not update other sliders so that they do not go to the total maximum
- I am currently using the .focusout () event in text fields because .change () makes it go crazy b / c, the slider also changes the text box.
Let me know what you think.
UPDATE:
I was sad not to hear any answers, but I think I hacked it. You need to limit the reliability of this source code and basically rewrite it. I will post my solution as an answer below. Please try and let me know what you think. It was quite a process, so hopefully someone finds this useful :)