saavedralbv/optigenius-engine-smart-portfolio-optimization
0
1// Smooth scrolling for anchor links2document.querySelectorAll('a[href^="#"]').forEach(anchor => {3 anchor.addEventListener('click', function (e) {4 e.preventDefault();5 document.querySelector(this.getAttribute('href')).scrollIntoView({6 behavior: 'smooth'7 });8 });9});10 11// Animation on scroll functionality12const animateOnScroll = () => {13 const elements = document.querySelectorAll('.animate-on-scroll');14 15 const observer = new IntersectionObserver((entries) => {16 entries.forEach(entry => {17 if (entry.isIntersecting) {18 entry.target.classList.add('animate-pop');19 observer.unobserve(entry.target);20 }21 });22 }, {23 threshold: 0.124 });25 26 elements.forEach(element => {27 observer.observe(element);28 });29};30 31// Initialize animations when DOM is loaded32document.addEventListener('DOMContentLoaded', () => {33 animateOnScroll();34});35 36// Any other global functionality can be added here