GeoGebra Classroom

# Dependent sliders with different speeds

## Description of example

Move the sliders and watch how the other sliders react with different speeds. Currently the speeds of the sliders are:
• a is1
• b is 0.5
• c is 2
• d is -1
If the checkbox Synchronize sliders is not checked you can change each slider without affecting the others.

## How to use it

1. Copy the whole code from my property Script -> `Global JavaScript` tab into your applet's `Global JavaScript` tab.
2. Put your sliders' names into the array `names_of_sliders` in the `ggbOnInit` function of the Global JavaScript property tab.
3. ﻿Put your sliders' speeds into the array `speeds` in the `ggbOnInit` function of the Global JavaScript property tab.
4. Add the line `﻿``update("name");` where `name` is this slider's name to the Scripting's Update property of each of your sliders.

## How it works

To see how this applet works, check the JavaScript of the elements. At the start of the applet a JS object `sliders` is created, which represents all sliders in JS. If you want to modify the code for your own applet, you have to change the Global JavaScript Code at two locations, that you can find at the beginning of the `ggbOnInit` function.
1. The array `names_of_sliders` has the names of your sliders.
2. The array `speeds` has the respective speeds, in the same order as the names. Every name needs exactly one speed for it at the same position.
Basically every move of a slider leads to a call to its update function.