How to execute JS in Storyline Block in Rise
I have a Storyline block in rise that is a web object so that I can have the audience interact with a web page. The problem is the web page has some overlay windows that end up taking over most of the screen real estate.
A used AI to write this code, added a trigger to execute this code When the timeline starts (also tried 1.5 sec in case it was triggering to soon).
Also tried tying it to a button and executing it on click but still no luck.
Anyone had luck closing overlay windows on a webpage inside of rise?
function closeOverlays() {
// Find all elements with the class 'overlay'
var overlays = document.querySelectorAll('.overlay');// Loop through each overlay and close it
overlays.forEach(async function(overlay) {
// Find the close button within the overlay
var closeButton = overlay.querySelector('.close-button');// If a close button is found, click it to close the overlay
if (closeButton) {
closeButton.click();
// Wait for the closing animation to complete
await new Promise(resolve => setTimeout(resolve, 500)); // Adjust the delay as needed
} else {
// Handle overlays without a close button
overlay.style.display = 'none';
}
});
}