Download script.js from Dr420000/ignite-digital-evolution-engine: direct link, hf CLI and curl.
- Browser
- Download file 3.63 kB
-
https://huggingface.co/spaces/Dr420000/ignite-digital-evolution-engine/resolve/main/script.js
- Command line
-
hf download hf://spaces/Dr420000/ignite-digital-evolution-engine/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Dr420000/ignite-digital-evolution-engine/resolve/main/script.js
3.63 kB
| // Shared JavaScript across all pages | |
| // Intersection Observer for scroll animations | |
| const observerOptions = { | |
| threshold: 0.1, | |
| rootMargin: '0px 0px -50px 0px' | |
| }; | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('visible'); | |
| } | |
| }); | |
| }, observerOptions); | |
| // Observe elements for animation | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const animatedElements = document.querySelectorAll('.fade-in, .slide-in-left, .slide-in-right'); | |
| animatedElements.forEach(el => { | |
| observer.observe(el); | |
| }); | |
| }); | |
| // Smooth scrolling for navigation links | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const navLinks = document.querySelectorAll('a[href^="#"]'); | |
| navLinks.forEach(link => { | |
| link.addEventListener('click', (e) => { | |
| e.preventDefault(); | |
| const targetId = link.getAttribute('href'); | |
| const targetElement = document.querySelector(targetId); | |
| if (targetElement) { | |
| targetElement.scrollIntoView({ | |
| behavior: 'smooth', | |
| block: 'start' | |
| }); | |
| } | |
| }); | |
| }); | |
| }); | |
| // Form handling | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const contactForm = document.querySelector('form'); | |
| if (contactForm) { | |
| contactForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| // Get form data | |
| const formData = new FormData(contactForm); | |
| const data = Object.fromEntries(formData); | |
| // Here you would typically send the data to your server | |
| console.log('Form submitted:', data); | |
| // Show success message (you can customize this) | |
| alert('Thank you for your message! We will get back to you soon.'); | |
| // Reset form | |
| contactForm.reset(); | |
| }); | |
| } | |
| }); | |
| // Mobile menu toggle (for future enhancement) | |
| class MobileMenu { | |
| constructor() { | |
| this.menuButton = document.querySelector('.mobile-menu-button'); | |
| this.menu = document.querySelector('.mobile-menu'); | |
| if (this.menuButton && this.menu) { | |
| this.menuButton.addEventListener('click', () => { | |
| this.menu.classList.toggle('hidden'); | |
| }); | |
| } | |
| } | |
| } | |
| // Initialize mobile menu | |
| document.addEventListener('DOMContentLoaded', () => { | |
| new MobileMenu(); | |
| }); | |
| // Counter animation for statistics | |
| function animateCounter(element, target, duration = 2000) { | |
| let start = 0; | |
| const increment = target / (duration / 16); | |
| const updateCounter = () => { | |
| start += increment; | |
| if (start < target) { | |
| element.textContent = Math.floor(start); | |
| requestAnimationFrame(updateCounter); | |
| } else { | |
| element.textContent = target; | |
| } | |
| }; | |
| updateCounter(); | |
| } | |
| // Initialize counters when they come into view | |
| const counterObserver = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| const target = parseInt(entry.target.getAttribute('data-target')); | |
| animateCounter(entry.target, target); | |
| } | |
| }); | |
| }, observerOptions); | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const counters = document.querySelectorAll('[data-target]'); | |
| counters.forEach(counter => { | |
| counterObserver.observe(counter); | |
| }); | |
| }); |