1document.addEventListener('DOMContentLoaded', function() { 2 const cycleContainers = document.querySelectorAll('.item-cycle'); 3 4 cycleContainers.forEach(container => { 5 const items = container.querySelectorAll('.cycle-item'); 6 if(items.length > 1) { 7 let currentIndex = 0; 8 setInterval(() => { 9 items[currentIndex].style.display = 'none'; 10 currentIndex = (currentIndex + 1) % items.length; 11 items[currentIndex].style.display = 'block'; 12 }, 2000); 13 } 14 }); 15});