// Particle background animation function initParticles() { particlesJS('particles-js', { particles: { number: { value: 100, // Increased number of particles density: { enable: true, value_area: 800 } }, color: { value: '#00ffbb' // Matching our primary color }, shape: { type: 'circle' }, opacity: { value: 0.8, // Increased opacity random: true, anim: { enable: true, speed: 1, opacity_min: 0.1, sync: false } }, size: { value: 3, random: true, anim: { enable: true, speed: 2, size_min: 0.1, sync: false } }, line_linked: { enable: true, distance: 150, color: '#00ffbb', opacity: 0.8, // Increased opacity width: 1 }, move: { enable: true, speed: 2, direction: 'none', random: false, straight: false, out_mode: 'out', bounce: false, attract: { enable: true, rotateX: 600, rotateY: 1200 } } }, interactivity: { detect_on: 'canvas', events: { onhover: { enable: true, mode: 'repulse' }, onclick: { enable: true, mode: 'push' }, resize: true }, modes: { repulse: { distance: 100, duration: 0.4 }, push: { particles_nb: 4 } } }, retina_detect: true }); } // Smooth scroll implementation function initSmoothScroll() { document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { const headerOffset = 80; const elementPosition = target.getBoundingClientRect().top; const offsetPosition = elementPosition - headerOffset; window.scrollBy({ top: offsetPosition, behavior: 'smooth' }); } }); }); // Add smooth scrolling to page navigation document.querySelectorAll('.nav-link').forEach(link => { link.addEventListener('click', function(e) { if (this.getAttribute('href').startsWith('#')) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } }); }); } // Add scroll to top button functionality function initScrollToTop() { const scrollToTopBtn = document.createElement('button'); scrollToTopBtn.innerHTML = '↑'; scrollToTopBtn.className = 'scroll-to-top'; document.body.appendChild(scrollToTopBtn); window.addEventListener('scroll', () => { if (window.pageYOffset > 100) { scrollToTopBtn.classList.add('show'); } else { scrollToTopBtn.classList.remove('show'); } }); scrollToTopBtn.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } // File upload preview function handleFileSelect(evt) { const file = evt.target.files[0]; if (file) { const reader = new FileReader(); reader.onload = function(e) { document.getElementById('preview-image').src = e.target.result; document.getElementById('preview-container').style.display = 'block'; }; reader.readAsDataURL(file); } } // Initialize all features document.addEventListener('DOMContentLoaded', function() { initParticles(); initSmoothScroll(); initScrollToTop(); // Initialize file input handler const fileInput = document.querySelector('input[type="file"]'); if (fileInput) { fileInput.addEventListener('change', handleFileSelect, false); } const sections = document.querySelectorAll('section'); const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('visible'); } }); }, { threshold: 0.1 }); // Adjust the threshold as needed sections.forEach(section => { observer.observe(section); }); });