Caricamento dati...
.ticker { display: flex; overflow: hidden; width: 100%; height: 30px; /* Altezza della striscia */ background-color: #333; /* Colore di sfondo */ color: white; /* Colore del testo */ font-family: Arial, sans-serif; font-size: 16px; line-height: 30px; /* Allineamento verticale del testo */ box-sizing: border-box; padding: 0 10px; } .ticker__item { white-space: nowrap; animation: scroll-left 15s linear infinite; } /* Animazione per lo scorrimento a sinistra */ @keyframes scroll-left { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } } Java document.addEventListener("DOMContentLoaded", function () { const ticker = document.querySelector(".ticker"); setInterval(function () { const newItem = document.createElement("div"); newItem.className = "ticker__item"; newItem.textContent = `Titolo ${Math.floor(Math.random() * 100)}: Aggiornamento casuale`; ticker.appendChild(newItem); if (ticker.children.length > 5) { ticker.removeChild(ticker.firstElementChild); } }, 5000); // Aggiorna ogni 5 secondi });