Creating a user input slider that averages out other input sliders

Hi there! I want to create a user input slider that automatically changes in response to other user input sliders. AKA slider #4 is the average of sliders 1 - 3. Is there a way to do this in wix? Thanks in advance!

You can get the average of all three input sliders, and then set the value of another Slider . or maybe even a ProgressBar . (See the links to see how to set the value)

Hi Yisrael, I’ve tried doing this:
let sliderValue = $w ( “#slider5” ). value = avg ( “#slider2” , “#slider3” , “#slider4” );
but avg continues to be underlined in red. Is there any way I can fix this?

What should → avg be?
Where did you found this (not existing) command?

It’s not a surprise that it is underlined in RED.

I was hoping to get the average of those three sliders. Is there a way to do that with these commands? Thank you!

-you have 4x different sliders in total.
-you group your sliders in 2x-groups.

Group-1: slider-1 → the overall-slider (avg-slider) which will be influenced by the sliders of the second group.

Group-2: slider2 - slider4.
This 3x sliders have a direct influence onto slider1.

How to get the avg?
Value of …
(slider1+slider2+slider3)
devided by number(count) of group2-sliders.

let slideValue2=$w(‘#slider2’).value
let slideValue3=$w(‘#slider3’).value
let slideValue4=$w(‘#slider4’).value

let slideAVG =
(slideValue2+slideValue3+slideValue4)/3

Now you got your avgValue of the 3-sliders.

What next? —> You have a VALUE!
Put that value into your slider1 and let your slider sliding :v::stuck_out_tongue_winking_eye:.

Of course everything will work if one of the 3x group2-sliders changing their values.

Generate a function like described above.
Start the generated function right from every changed/trighered-event of all 3x group2-sliders…

$w(‘#slider2’).onChange(()=>{…do function here…});

The same for the other 2x sliders.

Your function…

function calculateAVG() {
…your code here to calculate AVG…
}

Then put everything together and put it into the onReady-code-section.

Good-luck :v:

You’ll have to use the onChange() event of the sliders to update the average value.