Spaces:
Running
Running
File size: 3,193 Bytes
ccda123 3117d2c ccda123 3117d2c ccda123 3117d2c ccda123 3117d2c ccda123 3117d2c ccda123 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | document.addEventListener('DOMContentLoaded', function() {
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Enhanced Intersection Observer with staggered animations
const animateOnScroll = new IntersectionObserver((entries) => {
entries.forEach((entry, index) => {
if (entry.isIntersecting) {
setTimeout(() => {
entry.target.classList.add('animate-fadeInUp');
if (entry.target.classList.contains('float-animate')) {
entry.target.style.animationDelay = `${index * 0.1}s`;
}
animateOnScroll.unobserve(entry.target);
}, index * 100);
}
});
}, {
threshold: 0.1,
rootMargin: '0px 0px -100px 0px'
});
// Add particle effect to hero section
function initParticles() {
const hero = document.querySelector('.futuristic-bg');
if (!hero) return;
const particleCount = 30;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.className = 'particle';
particle.style.left = `${Math.random() * 100}%`;
particle.style.top = `${Math.random() * 100}%`;
particle.style.width = `${Math.random() * 3 + 1}px`;
particle.style.height = particle.style.width;
particle.style.background = `rgba(0, ${Math.random() * 155 + 100}, 255, ${Math.random() * 0.5 + 0.3})`;
particle.style.animationDuration = `${Math.random() * 10 + 5}s`;
hero.appendChild(particle);
}
}
// Initialize effects when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
initParticles();
});
document.querySelectorAll('.scroll-animate').forEach(el => {
animateOnScroll.observe(el);
});
// Mobile menu toggle (will be handled by navbar component)
// Form submission handling
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) {
e.preventDefault();
// Here you would typically handle form submission with fetch or similar
console.log('Form submitted');
// Show success message
const successMsg = document.createElement('div');
successMsg.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50';
successMsg.textContent = 'Thank you! Your message has been sent.';
document.body.appendChild(successMsg);
setTimeout(() => {
successMsg.remove();
}, 5000);
});
});
});
// Initialize feather icons
feather.replace();
// Initialize tooltips
tippy('[data-tippy-content]', {
arrow: true,
animation: 'fade',
});
|