Spaces:
Running
Running
Download script.js from saf4/feedio-api-express-hub: direct link, hf CLI and curl.
- Browser
- Download file 2.94 kB
-
https://huggingface.co/spaces/saf4/feedio-api-express-hub/resolve/main/script.js
- Command line
-
hf download hf://spaces/saf4/feedio-api-express-hub/script.js
-
curl -L -o script.js https://huggingface.co/spaces/saf4/feedio-api-express-hub/resolve/main/script.js
2.94 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Mobile menu toggle | |
| const mobileMenuButton = document.getElementById('mobile-menu-button'); | |
| const mobileMenu = document.createElement('div'); | |
| mobileMenu.id = 'mobile-menu'; | |
| mobileMenu.className = 'mobile-menu fixed inset-y-0 right-0 w-64 bg-white shadow-lg z-50 p-6'; | |
| mobileMenu.innerHTML = ` | |
| <div class="flex justify-between items-center mb-8"> | |
| <h2 class="text-xl font-bold text-primary-600">Menu</h2> | |
| <button id="close-mobile-menu"> | |
| <i data-feather="x"></i> | |
| </button> | |
| </div> | |
| <nav> | |
| <ul class="space-y-4"> | |
| <li><a href="#extension" class="block py-2 hover:text-primary-600 transition-colors">Extension</a></li> | |
| <li><a href="#software" class="block py-2 hover:text-primary-600 transition-colors">Software</a></li> | |
| <li><a href="#features" class="block py-2 hover:text-primary-600 transition-colors">Features</a></li> | |
| </ul> | |
| </nav> | |
| `; | |
| document.body.appendChild(mobileMenu); | |
| mobileMenuButton.addEventListener('click', function() { | |
| mobileMenu.classList.add('active'); | |
| feather.replace(); | |
| document.getElementById('close-mobile-menu').addEventListener('click', function() { | |
| mobileMenu.classList.remove('active'); | |
| }); | |
| }); | |
| // Close mobile menu when clicking on a link | |
| const mobileLinks = mobileMenu.querySelectorAll('a'); | |
| mobileLinks.forEach(link => { | |
| link.addEventListener('click', function() { | |
| mobileMenu.classList.remove('active'); | |
| }); | |
| }); | |
| // Smooth scroll for all links with hashes | |
| 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) { | |
| targetElement.scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Feather icons replacement | |
| feather.replace(); | |
| // Animation on scroll | |
| const animateOnScroll = function() { | |
| const elements = document.querySelectorAll('.feature-card, section[id]'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const windowHeight = window.innerHeight; | |
| if (elementPosition < windowHeight - 100) { | |
| element.classList.add('animate-fadeIn'); | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); // Run once on page load | |
| }); |