Document #banner { width: 100%; background-color: red; color: white; text-align: center; padding: 10px 0; font-size: 20px; opacity: 0; transition: opacity 2s; position: fixed; top: 0; left: 0; } document.addEventListener("DOMContentLoaded", function() { const banner = document.getElementById('banner'); let visible = false; function toggleVisibility() { visible = !visible; banner.style.opacity = visible ? '1' : '0'; setTimeout(toggleVisibility, 4000); // Change text every 4 seconds } setTimeout(toggleVisibility, 500); // Start after 500 ms });