Forum Discussion
DavidKelling1
2 years agoCommunity Member
do once on resume
Hi,
I'd like to do something once (execute a javascript) if the user chose to resume after launching (and therefore not do it if new launch or restart). I need it to happen once no matter what sl...
Nedim
2 years agoCommunity Member
I think this JavaScript code should do the trick:const resumed = document.querySelector('[data-dv_ref="resume"]');
if (resumed) {
GetPlayer().SetVar('Resumed', true)
}
In your project, create a variable (eg. Resumed). set it to False. Execute JavaScript When the timeline starts on this slide. When you launch the course for the first time, "Resumed" will be False because the Resume button is not yet visible, When you reload the course, the Resume button shows and turn the "Resumed" variable to True when the course is resumed. You should probably place the Execute JavaScript trigger in the Master slide. Your "Resumed" variable will keep its value throughout the course unless you change it on purpose.