// Auto-rotate slideshow every 3 seconds let heroSlideInterval; function startHeroSlideshow() { const carousel = document.querySelector('[data-landingsite-carousel]'); const rightButton = document.querySelector('[data-landingsite-carousel-controls-right]'); if (carousel && rightButton) { heroSlideInterval = setInterval(() => { rightButton.click(); }, 3000); // 3 seconds } } function stopHeroSlideshow() { if (heroSlideInterval) { clearInterval(heroSlideInterval); heroSlideInterval = null; } } function init() { // Start the slideshow auto-rotation startHeroSlideshow(); // Pause slideshow when user hovers over it const carousel = document.querySelector('[data-landingsite-carousel]'); if (carousel) { carousel.addEventListener('mouseenter', stopHeroSlideshow); carousel.addEventListener('mouseleave', startHeroSlideshow); } } function teardown() { // Clean up the interval stopHeroSlideshow(); // Remove event listeners const carousel = document.querySelector('[data-landingsite-carousel]'); if (carousel) { carousel.removeEventListener('mouseenter', stopHeroSlideshow); carousel.removeEventListener('mouseleave', startHeroSlideshow); } } export { init, teardown };