Spaces:
Configuration error
Configuration error
Download script.js from Maxim7575/pixel-magic-academy: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/Maxim7575/pixel-magic-academy/resolve/main/script.js
- Command line
-
hf download hf://spaces/Maxim7575/pixel-magic-academy/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Maxim7575/pixel-magic-academy/resolve/main/script.js
1.27 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // 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' | |
| }); | |
| }); | |
| }); | |
| // Back to top button functionality | |
| const backToTopButton = document.createElement('button'); | |
| backToTopButton.innerHTML = '<i data-feather="arrow-up"></i>'; | |
| backToTopButton.className = 'fixed bottom-6 left-6 bg-primary-600 text-white p-3 rounded-full shadow-lg hover:bg-primary-700 transition duration-300 hidden'; | |
| document.body.appendChild(backToTopButton); | |
| window.addEventListener('scroll', function() { | |
| if (window.pageYOffset > 300) { | |
| backToTopButton.classList.remove('hidden'); | |
| } else { | |
| backToTopButton.classList.add('hidden'); | |
| } | |
| }); | |
| backToTopButton.addEventListener('click', function() { | |
| window.scrollTo({ | |
| top: 0, | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| // Initialize feather icons | |
| feather.replace(); | |
| }); |