Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize ScrollReveal | |
| const sr = ScrollReveal({ | |
| origin: 'bottom', | |
| distance: '50px', | |
| duration: 1000, | |
| delay: 200, | |
| reset: true | |
| }); | |
| // Reveal elements | |
| sr.reveal('.project-card', { interval: 200 }); | |
| // Smooth scroll | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Add reveal class when elements are in view | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('reveal'); | |
| } | |
| }); | |
| }, { threshold: 0.1 }); | |
| document.querySelectorAll('.project-card').forEach(card => { | |
| observer.observe(card); | |
| }); | |
| }); | |