Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread Poll:
Author: Subject: Limit for sum of multiple sliders' values.
ManuW
Junior Member

Posts: 2
Registered: 12/12/2007
Location: Austria
Member Is Offline
posted on 12/13/2007 at 12:00 AM Reply With Quote
Limit for sum of multiple sliders' values.


Hello there,
I first want to thank you for this cool tool. It's really nice.

Now, maybe someone can help me.
I have three sliders in one form. The user can mixture some ingredients together, so that the sum of all three sliders' values may not exceed 100%.

How can I set this limit, so that the user can't raise the values if it is reached?

Thanks in advance for your help. Sincerely,
-Manuel
View User's Profile View All Posts By User U2U Member
ManuW
Junior Member

Posts: 2
Registered: 12/12/2007
Location: Austria
Member Is Offline
posted on 12/13/2007 at 11:14 PM Reply With Quote
I found a very easy way.


I modified the function f_sliderSetValue() by adding following lines at the end right after "e_input.value = n_value;"

var tmpSum = 0;
for(var i = 0; i < A_SLIDERS.length; i++) {
tmpSum += A_SLIDERS.n_value;
}
if(tmpSum > 100) {
this.f_setValue(n_value - 10);
}

This can surely be implemented more elegant, but it works. ;-)
Greetings.
-Manuel
View User's Profile View All Posts By User U2U Member
mdzoidberg
Newbie

Posts: 1
Registered: 3/25/2008
Location: USA
Member Is Offline
posted on 3/26/2008 at 12:02 AM Reply With Quote

Hi, not sure if you still keep track of this forum, is there any way for you to give more insight as to how apply your code to limit the sum of multiple sliders, i tried your extra code but is not doing the trick, any help is appreciated, thanks.

Quote:
Originally posted by ManuW
I modified the function f_sliderSetValue() by adding following lines at the end right after "e_input.value = n_value;"

var tmpSum = 0;
for(var i = 0; i < A_SLIDERS.length; i++) {
tmpSum += A_SLIDERS.n_value;
}
if(tmpSum > 100) {
this.f_setValue(n_value - 10);
}

This can surely be implemented more elegant, but it works. ;-)
Greetings.
-Manuel
View User's Profile View All Posts By User U2U Member
Post new thread Poll:

Related Links:
Product Page
Product Demonstrations Live Demos
Multiple Designs
Equalizer
Free Download Free Download
Product Documentation Documentation:
Documentation Page
Change Log
Support Forum Support Forum

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004