File size: 1,706 Bytes
127cd6c 33e7962 1d10032 33e7962 87455a0 33e7962 87455a0 1d10032 87455a0 1d10032 33e7962 1d10032 33e7962 1d10032 33e7962 87455a0 33e7962 87455a0 1d10032 87455a0 1d10032 33e7962 87455a0 33e7962 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
// 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'
});
});
});
}); |