Spaces:
Running
Running
Download script.js from AlexiDevs/cosmic-code-canvas: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/spaces/AlexiDevs/cosmic-code-canvas/resolve/main/script.js
- Command line
-
hf download hf://spaces/AlexiDevs/cosmic-code-canvas/script.js
-
curl -L -o script.js https://huggingface.co/spaces/AlexiDevs/cosmic-code-canvas/resolve/main/script.js
1.55 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize animations | |
| initAnimations(); | |
| // Load projects | |
| loadProjects(); | |
| // 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' | |
| }); | |
| }); | |
| }); | |
| // Animate skill bars on scroll | |
| const skillBars = document.querySelectorAll('.skill-bar'); | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| const percent = entry.target.getAttribute('data-percent'); | |
| entry.target.style.width = `${percent}%`; | |
| } | |
| }); | |
| }, {threshold: 0.5}); | |
| skillBars.forEach(bar => { | |
| observer.observe(bar); | |
| }); | |
| }); | |
| function initAnimations() { | |
| // Add hover effects to all tech icons | |
| const techIcons = document.querySelectorAll('.tech-icon'); | |
| techIcons.forEach(icon => { | |
| icon.addEventListener('mouseenter', () => { | |
| icon.querySelector('svg').style.transform = 'scale(1.2)'; | |
| }); | |
| icon.addEventListener('mouseleave', () => { | |
| icon.querySelector('svg').style.transform = 'scale(1)'; | |
| }); | |
| }); | |
| } | |
| function loadProjects() { | |
| // This function is now empty since we're using static HTML for bots | |
| } | |