Spaces:
Running
Running
File size: 1,191 Bytes
26e6c1b | 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 | document.addEventListener('DOMContentLoaded', () => {
// Initialize Lucide icons
lucide.createIcons();
// Intersection Observer for scroll animations
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
// Optional: Stop observing once animated
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Select all elements to animate
document.querySelectorAll('.animate-on-scroll').forEach(el => {
observer.observe(el);
});
// Navbar scroll effect
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.style.boxShadow = '0 4px 6px -1px rgba(0, 0, 0, 0.1)';
navbar.style.padding = '0.75rem 0';
} else {
navbar.style.boxShadow = 'none';
navbar.style.padding = '1rem 0';
}
});
});
|