| // Smooth scroll to top when navigating to discourse page | |
| document.querySelectorAll('a[href="discourse.html"]').forEach(link => { | |
| link.addEventListener('click', () => { | |
| window.scrollTo({ top: 0, behavior: 'smooth' }); | |
| }); | |
| }); | |
| // Initialize GSAP animations for navbar items | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Animate the logo on hover | |
| const logo = document.querySelector('.group'); | |
| const logoCircle = logo.querySelector('circle'); | |
| const logoText = logo.querySelector('g'); | |
| logo.addEventListener('mouseenter', () => { | |
| gsap.to(logo.querySelector('svg'), { | |
| rotation: 360, | |
| duration: 1.5, | |
| ease: 'elastic.out(1, 0.5)' | |
| }); | |
| gsap.to(logoCircle, { | |
| strokeWidth: 2.5, | |
| duration: 0.5 | |
| }); | |
| gsap.to(logoText, { | |
| scale: 1.1, | |
| duration: 0.5, | |
| transformOrigin: 'center center' | |
| }); | |
| }); | |
| logo.addEventListener('mouseleave', () => { | |
| gsap.to(logo.querySelector('svg'), { | |
| rotation: 0, | |
| duration: 1, | |
| ease: 'back.out(1.7)' | |
| }); | |
| gsap.to(logoCircle, { | |
| strokeWidth: 1.5, | |
| duration: 0.5 | |
| }); | |
| gsap.to(logoText, { | |
| scale: 1, | |
| duration: 0.5 | |
| }); | |
| }); | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| }); |