File size: 2,362 Bytes
d1881dd | 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 85 86 | // Initialize Lucide icons
lucide.createIcons();
// Navbar scroll effect
const navbar = document.getElementById('navbar');
let lastScroll = 0;
window.addEventListener('scroll', () => {
const currentScroll = window.pageYOffset;
if (currentScroll > 50) {
navbar.classList.add('shadow-sm');
} else {
navbar.classList.remove('shadow-sm');
}
lastScroll = currentScroll;
});
// Intersection Observer for fade-in animations
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fade-in-up');
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe elements
document.querySelectorAll('.group').forEach((el) => {
el.style.opacity = '0';
observer.observe(el);
});
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Interactive hover effects for feature cards
document.querySelectorAll('.group').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.opacity = '1';
});
});
// Mobile menu toggle (if needed for future expansion)
const mobileMenuBtn = document.createElement('button');
mobileMenuBtn.className = 'md:hidden p-2';
mobileMenuBtn.innerHTML = '<i data-lucide="menu" class="w-6 h-6"></i>';
mobileMenuBtn.onclick = () => {
// Toggle mobile menu logic here
console.log('Mobile menu toggled');
};
// Re-initialize icons after dynamic content
setTimeout(() => {
lucide.createIcons();
}, 100);
// Add subtle parallax effect to hero section
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const parallaxElements = document.querySelectorAll('.animate-float');
parallaxElements.forEach(el => {
const speed = 0.5;
el.style.transform = `translateY(${scrolled * speed}px)`;
});
}); |