Move slider with mouse or arrow keys

Hi elearning heroes.

I made a course with a slider page. It has 4 layers plus the base layer and as you move the slider, a new layer displays. You have to view all 4 "extra" layers to advance to the next slide.

The slider and slide works perfectly using the mouse to advance the slider.

My internal client was concerned because some of our users have laptops with trackpads and found it difficult to drag the slider with a trackpad. So I got a simple request, can I add "arrow key" functionality too.

Seems simple, right?

Well I have it working by adding a slide trigger to adjust the slider variable when the user presses the right or left arrow key.

But... if the user move the slider out of the default and then back to the default starting position using the arrow keys, the slider gets "stuck" and doesn't respond to more arrow key presses. It does respond if I use the mouse.

I've attached a .story file so you can see what I mean. The mouse always works, but they key presses get lost somewhere.

Any help would be appreciated!

14 Replies
Steve Gannon

John, one thing you should do is ensure the slider value never gets out of range; that is, you don't want it to ever be less than zero or greater than 4. To do this, add a condition to each of your keypress triggers. (Add 1 to Slider2 *IF* Slider2 is less than 4. Subtract 1 from Slider2 *IF* Slider2 is greater than 0.)

John Krikorian

Hi gentlemen

I see Michael's changes, and he did what Steve suggested, but I still get the same behavior.

Here is what I'm doing with Michael's story:

  • Preview project
  • Press Left arrow 4 times (Everything works fine, at step/layer 4)
  • Press Right arrow 4 times (Everything works fine, back to base layer/background notes)
  • Press Left arrow once, nothing happens. (Mouse still works)
John Krikorian

Oh yeah, I had it backward.

Here is what I'm doing with Michael's story:

  • Preview project
  • Press Right arrow 4 times (Everything works fine, at step/layer 4)
  • Press Left arrow 4 times (Everything works fine, back to base layer/background notes)
  • Press Right arrow once, nothing happens. (Mouse still works)

Wow, Steven, in Michael's .story file I still get locked following the steps above. How odd.