Spaces:
Running
Running
| // Main scripts for the application | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize animations | |
| const animateElements = () => { | |
| const elements = document.querySelectorAll('.animate-fade, .animate-slide'); | |
| elements.forEach((el, i) => { | |
| el.style.animationDelay = `${i * 100}ms`; | |
| el.style.opacity = 0; | |
| setTimeout(() => { | |
| el.style.opacity = 1; | |
| }, i * 100); | |
| }); | |
| }; | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const targetId = this.getAttribute('href'); | |
| if (targetId !== '#') { | |
| document.querySelector(targetId).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Initialize mobile menu toggle | |
| document.addEventListener('click', (e) => { | |
| if (e.target.closest('[data-toggle-menu]')) { | |
| const menu = document.querySelector('mobile-menu'); | |
| menu.hasAttribute('open') | |
| ? menu.removeAttribute('open') | |
| : menu.setAttribute('open', ''); | |
| } | |
| }); | |
| // Initialize animations on page load | |
| animateElements(); | |
| }); | |