Controlling a slider with Javascript

Apr 12, 2019

Hello Heroes,

I'm looking for tips on to control a slider with javascript code.

  • The slider has 400 steps (start 0, end 400), intializes at 400, and uses steps of 1.
  • The connected variable is "sliderbg".

 

I'd like to have the variable sliderbg (and the corresponding slider) count down from 400 to 0, but I can't seem to get this to work.

I'm a JS noob, looking things up mostly for this.

Any tips?

4 Replies
Steve Gannon

Hi Karen,

Attached is a Storyline 360 file that illustrates the technique Phil referred to.

Presumably, you don't want the user interacting with the slider while it's auto-moving; therefore, I inserted a transparent box over the slider to prevent user interaction with it until the slider reaches 0 and the end of the timeline is reached.

You can speed up the rate at which the slider moves by changing the decrement value in the trigger in the first layer from 1 to 2 (or 3 or 4 or whatever). You can slow down the rate by changing the "Timeline reaches" value of the trigger in the second layer from 0.01 to 0.05 or 0.1 or whatever.

This discussion is closed. You can start a new discussion or contact Articulate Support.