CoolFace
Apppublic

RashFever/code-conductor-with-a-smile

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
script.js23 linesDownload Raw Back to root
1// Shared JavaScript across all pages2document.addEventListener('DOMContentLoaded', () => {3    console.log('Personal site loaded');4    5    // Smooth scrolling for anchor links6    document.querySelectorAll('a[href^="#"]').forEach(anchor => {7        anchor.addEventListener('click', function (e) {8            e.preventDefault();9            10            const targetId = this.getAttribute('href');11            if (targetId === '#') return;12            13            const targetElement = document.querySelector(targetId);14            if (targetElement) {15                targetElement.scrollIntoView({16                    behavior: 'smooth'17                });18            }19        });20    });21    22    // Mobile menu toggle functionality can be added here if needed23});