Forum Discussion
Exit SL via JavaScript
One obvious error i noticed in your Javascript... <script> tags were in the code. They are not needed when using triggers in Storyline to execute JS. After removing that and checking the console i noticed an error that 'player' was called multiple times. That indicates your setting that variable at multiple positions whereas that is only needed once. Im gonna check it further...
Removing the let player variable i got rid of the error, but it still doesnot work. I do suspect your timer function is never called. What i often do to get things like this working...add console.log statements to your code to see if something happens...and debug that way. Also helps to see onscreen the needed variables.. 'Exit_Course' being one of them...gonna check some more...
Ah yes.. another never executing part of code... $ signs in code indicate jQuery is used. And since quite a while jQuery is not standard included in Storyline. So you either need to manually add jQuery or use Vanilla Javascript for all parts with $ in the code.
Quite sure this is the final barrier...
This is a good resource for converting jQuery to Vanilla JS
https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/
And still some errors.. 'startClock' is not defined. Gonna get it right :-)
Related Content
- 5 months ago