document.addEventListener("DOMContentLoaded", function() { // var startButton = document.getElementById("startButton"); // startButton.addEventListener("click", function() { let fun = function() { startButton.style.display = "none"; // Ottieni il riferimento al contenitore del gioco var gameContainer = document.getElementById("gameContainer"); var ruota = document.getElementById("gameIframe"); // Mostra il contenitore del gioco gameContainer.style.display = "block"; var ruota = document.getElementById("block"); // Ottieni il riferimento al video del gioco var gameVideo = document.getElementById("gameVideo"); // Avvia il video gameVideo.play(); // Aggiungi una classe CSS per far girare la ruota gameContainer.classList.add("spin"); loadIframeWithTimeout(); }; fun(); }); function loadIframeWithTimeout() { // Specify the timeout duration in milliseconds (e.g., 3000ms = 3 seconds) var timeoutDuration = 0; // Wait for the specified timeout setTimeout(function() { // Create the iframe element var iframe = document.createElement('iframe'); // Set the source URL of the iframe iframe.src = './ruota.html'; // Set the desired attributes for the iframe iframe.width = '100%'; iframe.height = '100%'; iframe.frameBorder = '0'; // Apply CSS styles to cut the left part and center the iframe iframe.style.position = 'absolute'; // iframe.style.left = '50%'; // iframe.style.transform = 'translateX(-50%)'; // Append the iframe to the bottom of the document body document.body.appendChild(iframe); console.log("loaded"); }, timeoutDuration); } function disableScroll() { document.addEventListener('wheel', preventDefault); document.addEventListener('touchmove', preventDefault); document.addEventListener('keydown', preventDefault); } function enableScroll() { document.removeEventListener('wheel', preventDefault); document.removeEventListener('touchmove', preventDefault); document.removeEventListener('keydown', preventDefault); } function preventDefault(event) { event.preventDefault(); } // Call disableScroll() to disable scrolling disableScroll(); var toggleButton = document.getElementById('toggleButton'); var contentDiv = document.getElementById('gameVideo'); toggleButton.addEventListener('click', function() { if (contentDiv.style.display === 'none') { contentDiv.style.display = 'block'; } else { contentDiv.style.display = 'none'; } }); // document.getElementById("legend-button").addEventListener("click", function() { // document.getElementById("legend-modal").style.display = "block"; // }); document.getElementById("close-button").addEventListener("click", function() { document.getElementById("legend-modal").style.display = "none"; });