calvindev/african-wisdom-academy
0
1 2document.addEventListener('DOMContentLoaded', function() {3 // Initialize navbar and footer4 if (!customElements.get('custom-navbar')) {5 customElements.define('custom-navbar', class extends HTMLElement {});6 }7 if (!customElements.get('custom-footer')) {8 customElements.define('custom-footer', class extends HTMLElement {});9 }10// Animation on scroll11 const animateOnScroll = () => {12 const elements = document.querySelectorAll('.card, .testimonial');13 elements.forEach(element => {14 const elementPosition = element.getBoundingClientRect().top;15 const screenPosition = window.innerHeight / 1.3;16 17 if(elementPosition < screenPosition) {18 element.classList.add('animate-fadeInUp');19 }20 });21 };22 23 window.addEventListener('scroll', animateOnScroll);24 animateOnScroll(); // Run once on load25 26 // Form submission27 const forms = document.querySelectorAll('form');28 forms.forEach(form => {29 form.addEventListener('submit', function(e) {30 e.preventDefault();31 const toast = new bootstrap.Toast(document.getElementById('formToast'));32 toast.show();33 this.reset();34 });35 });36});37 38// Initialize tooltips39const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));40tooltipTriggerList.map(function (tooltipTriggerEl) {41 return new bootstrap.Tooltip(tooltipTriggerEl);42});43 