Spaces:
Running
Running
Download script.js from lourealiza/timeproof: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/spaces/lourealiza/timeproof/resolve/main/script.js
- Command line
-
hf download hf://spaces/lourealiza/timeproof/script.js
-
curl -L -o script.js https://huggingface.co/spaces/lourealiza/timeproof/resolve/main/script.js
1.39 kB
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const targetId = this.getAttribute('href'); | |
| if(targetId === '#') return; | |
| const targetElement = document.querySelector(targetId); | |
| if(targetElement) { | |
| window.scrollTo({ | |
| top: targetElement.offsetTop - 80, | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Animation on scroll | |
| const observerOptions = { | |
| root: null, | |
| rootMargin: '0px', | |
| threshold: 0.1 | |
| }; | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if(entry.isIntersecting) { | |
| entry.target.classList.add('animate-fadeInUp'); | |
| } | |
| }); | |
| }, observerOptions); | |
| document.querySelectorAll('.bg-gray-800, .bg-gray-900').forEach(el => { | |
| observer.observe(el); | |
| }); | |
| // Add animation classes | |
| const style = document.createElement('style'); | |
| style.innerHTML = ` | |
| @keyframes fadeInUp { | |
| from { | |
| opacity: 0; | |
| transform: translateY(20px); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0); | |
| } | |
| } | |
| .animate-fadeInUp { | |
| animation: fadeInUp 0.6s ease-out forwards; | |
| } | |
| `; | |
| document.head.appendChild(style); |