Forum Discussion
How to Jump to a certain slide using Javascript
Hello! I need to Jump to a certain slide using Javascript, however methods listed back in 2013 for Player object seems to be not working anymore, like player.setSlideIndex(index)
Perhaps, I'm doing something wrong?
var player = GetPlayer();
player.setSlideIndex(1.37)?
6 Replies
- JaimeSalazarCommunity Member
Thanks a lot.
- Nathan_HilliardCommunity Member
Have a look at this for an idea. Note, I've never used this technique for anything, so I can't tell you if it has problems. I just thought you could play around with it.
Use the slider to trigger JavaScript (both on master). You need the slide IDs to specify the jump destination.
https://360.articulate.com/review/content/f2d9996d-2811-45a5-b083-89f78988a743/review
- JaimeSalazarCommunity Member
Hello.
I've been trying the example you attached, and something strange is happening to me.
While running it in "review" through the link you provided works correctly; if I download the file and publish it, it doesn't work; I get a JavaScript error saying "player.JumpToSlide is not a function."The version of Storyline 360 I'm using is v3.98.34263.0. I don't know if the function has changed its name in this version or if it no longer exists.
I would appreciate any feedback on this, as it would be a good resource for multilingual content when switching languages.
Best regards, and thank you.
- Nathan_HilliardCommunity Member
Sorry about that. That is actually an experimental function that hasn't made it into regular production use. At the time of this post, I did not realize the limitation. It is only automatically available when publishing to Review 360.
You can make it available for your published project by enabling Dark-Spider mode. See Jürgen Schoene's contribution to the following post for instructions. It requires one line of code to be added to the published story.html file. It is easy enough, and adds several potential functions that you could explore. Totally not guaranteed by anyone though 🙂.
JumpToSlide in JavaScript Not Working | Articulate - Community
- EsmeraldaBar868Community Member
Thanks!
I have a timer that is only active on certain slides. The timer itself is a SetInterval method.
What I'm trying to do is to JumpToSlide from the function, but I can't find the correct method for Player, which does that.
The idea is to avoid putting the trigger on each slide I need (about 20) or on the Master slide which will affect the whole project in my case. - AndrewHanleyCommunity Member
You could just use JS to set a Storyline variable value.
Then a simple "when variable changes..." trigger would immediately jump to whatever slide is called.
You could even put that trigger on the Master slide if you want it to happen on every single slide.