Tanuj1075/three-js-wonderland
0
1 2document.addEventListener('DOMContentLoaded', () => {3 // Smooth scrolling for anchor links4 document.querySelectorAll('a[href^="#"]').forEach(anchor => {5 anchor.addEventListener('click', function (e) {6 e.preventDefault();7 document.querySelector(this.getAttribute('href')).scrollIntoView({8 behavior: 'smooth'9 });10 });11 });12 13 // Intersection Observer for animations14 const observer = new IntersectionObserver((entries) => {15 entries.forEach(entry => {16 if (entry.isIntersecting) {17 entry.target.classList.add('animate-fadeIn');18 }19 });20 }, { threshold: 0.1 });21 22 document.querySelectorAll('.animate-on-scroll').forEach(el => {23 observer.observe(el);24 });25});26 