Forum Discussion

EsmeraldaBar868's avatar
EsmeraldaBar868
Community Member
11 months ago

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

    • JaimeSalazar's avatar
      JaimeSalazar
      Community 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_Hilliard's avatar
        Nathan_Hilliard
        Community 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

         

  • 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.


  • 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.