Forum Discussion
KatelynThedf665
7 months agoCommunity Member
Help: Need Project to Loop Back to Menu After 60 Seconds
Hello! I am building a project that will serve as an interactive demo. There will be no audio, but it will have text/asset/mouse animations to guide users through the experience. The slides animate a...
SamHill
7 months agoSuper Hero
Hi KatelynThedf665 firstly you will need to create a Storyline variable that will trigger the action to return to the menu/selection slide, when the variable changes.
- Create a Storyline True/False variable called resetPresentation and ensure the initial value is False.
- Add a timeline starts trigger to your menu/selection slide that will set the value of resetPresentation to False.
- Add a variable changes trigger to the MASTERSLIDE. When variable resetPresentation changes, and resetPresentation is equal to True, jump to the menu/selection slide in the project.
- Add the following JavaScript to the MASTERSLIDE and trigger on timeline starts.
function resetInactivityTimer() { console.log('resetInactivityTimer'); clearTimeout(window.inactivityTimerB19063f9); window.inactivityTimerB19063f9 = setTimeout(() => { console.log('reset presentation'); setVar('resetPresentation', true); }, 60000); } function initInactivityDetection() { // add event listeners console.log('initInactivityDetection'); document.addEventListener("mousemove", resetInactivityTimer); document.addEventListener("keydown", resetInactivityTimer); document.addEventListener("click", resetInactivityTimer); document.addEventListener("scroll", resetInactivityTimer); // Start the timer initially resetInactivityTimer(); } // Initialise the inactivity detection if (!window.inactivityTimerB19063f9) initInactivityDetection();
I've attached a simple example of the functionality (shortened to 10 second timeout for demo).