| |
| lucide.createIcons(); |
|
|
| |
| 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; |
| }); |
|
|
| |
| 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); |
|
|
| |
| document.querySelectorAll('.group').forEach((el) => { |
| el.style.opacity = '0'; |
| observer.observe(el); |
| }); |
|
|
| |
| 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' |
| }); |
| } |
| }); |
| }); |
|
|
| |
| document.querySelectorAll('.group').forEach(card => { |
| card.addEventListener('mouseenter', function() { |
| this.style.opacity = '1'; |
| }); |
| }); |
|
|
| |
| 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 = () => { |
| |
| console.log('Mobile menu toggled'); |
| }; |
|
|
| |
| setTimeout(() => { |
| lucide.createIcons(); |
| }, 100); |
|
|
| |
| 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)`; |
| }); |
| }); |