Download script.js from echoshop/echoboost-landing-machine: direct link, hf CLI and curl.
- Browser
- Download file 3.06 kB
-
https://huggingface.co/spaces/echoshop/echoboost-landing-machine/resolve/main/script.js
- Command line
-
hf download hf://spaces/echoshop/echoboost-landing-machine/script.js
-
curl -L -o script.js https://huggingface.co/spaces/echoshop/echoboost-landing-machine/resolve/main/script.js
3.06 kB
| // Main JavaScript for Echo Shop Landing Page | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // FAQ Accordion functionality | |
| const faqButtons = document.querySelectorAll('#duvidas button'); | |
| faqButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| const content = button.nextElementSibling; | |
| const icon = button.querySelector('i'); | |
| // Toggle content | |
| if (content.style.maxHeight) { | |
| content.style.maxHeight = null; | |
| icon.setAttribute('data-feather', 'chevron-down'); | |
| } else { | |
| content.style.maxHeight = content.scrollHeight + 'px'; | |
| icon.setAttribute('data-feather', 'chevron-up'); | |
| } | |
| feather.replace(); | |
| }); | |
| }); | |
| // Smooth scroll 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 animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.animate-on-scroll'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const windowHeight = window.innerHeight; | |
| if (elementPosition < windowHeight - 100) { | |
| element.classList.add('animate-fade-in'); | |
| } | |
| }); | |
| }; | |
| // Initialize animations | |
| document.querySelectorAll('section').forEach((section, index) => { | |
| if (index > 0) { // Skip first section | |
| section.querySelectorAll('h2, p, div').forEach(el => { | |
| el.classList.add('animate-on-scroll'); | |
| el.style.opacity = '0'; | |
| }); | |
| } | |
| }); | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); // Run once on load | |
| // Sticky navigation | |
| const nav = document.querySelector('nav'); | |
| const navOffset = nav.offsetTop; | |
| window.addEventListener('scroll', () => { | |
| if (window.pageYOffset > navOffset) { | |
| nav.classList.add('shadow-md', 'bg-opacity-90'); | |
| nav.style.backdropFilter = 'blur(8px)'; | |
| } else { | |
| nav.classList.remove('shadow-md', 'bg-opacity-90'); | |
| nav.style.backdropFilter = 'none'; | |
| } | |
| }); | |
| // Replace all feather icons | |
| feather.replace(); | |
| // Button hover effects | |
| document.querySelectorAll('a[href="#cta"]').forEach(button => { | |
| button.classList.add('btn-hover-effect'); | |
| }); | |
| }); |