// JavaScript to trigger scroll-based animations window.addEventListener("scroll", function () { const elements = document.querySelectorAll(".hero-section, .features, .courses, .testimonials, .contact-section"); elements.forEach(function (element) { if (element.getBoundingClientRect().top < window.innerHeight) { element.classList.add("visible"); } }); }); document.addEventListener("DOMContentLoaded", function() { const faqItems = document.querySelectorAll(".faq-item"); faqItems.forEach(item => { item.querySelector(".faq-question").addEventListener("click", () => { item.classList.toggle("active"); }); }); }); // Get the button const scrollToTopButton = document.getElementById("scroll-to-top"); // When the user scrolls down 100px from the top of the document, show the button window.onscroll = function() { if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { scrollToTopButton.style.display = "block"; } else { scrollToTopButton.style.display = "none"; } }; // When the user clicks on the button, scroll to the top of the document scrollToTopButton.addEventListener("click", function() { window.scrollTo({ top: 0, behavior: "smooth" // Smooth scroll effect }); });