document.addEventListener('DOMContentLoaded', function() { // FAQ Toggle const faqItems = document.querySelectorAll('.faq-item'); faqItems.forEach(item => { const question = item.querySelector('.faq-question'); question.addEventListener('click', () => { // Close all other items faqItems.forEach(otherItem => { if (otherItem !== item && otherItem.classList.contains('active')) { otherItem.classList.remove('active'); } }); // Toggle current item item.classList.toggle('active'); }); }); // Scroll to Top Button const scrollTopButton = document.getElementById('scrollTopButton'); // Show/hide button based on scroll position window.addEventListener('scroll', function() { if (window.scrollY > 300) { scrollTopButton.style.display = 'block'; } else { scrollTopButton.style.display = 'none'; } }); // Scroll to top when button is clicked scrollTopButton.addEventListener('click', function() { window.scrollTo({ top: 0, behavior: 'smooth' }); }); // Media Banner Responsive Handling function checkMobile() { const isMobile = window.innerWidth < 768; const spBanner = document.querySelector('.sp-banner'); const pcBanner = document.querySelector('.pc-banner'); if (isMobile) { spBanner.style.display = 'block'; pcBanner.style.display = 'none'; } else { spBanner.style.display = 'none'; pcBanner.style.display = 'block'; } } // Initial check checkMobile(); // Check on resize window.addEventListener('resize', checkMobile); });