diff options
Diffstat (limited to 'divine/script.js')
-rw-r--r-- | divine/script.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/divine/script.js b/divine/script.js new file mode 100644 index 0000000..ec6a283 --- /dev/null +++ b/divine/script.js @@ -0,0 +1,43 @@ +// 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
+ });
+});
+
+
+
|