Spaces:
Running
Running
Download script.js from brownj55/buildmaster-pro: direct link, hf CLI and curl.
- Browser
- Download file 1.89 kB
-
https://huggingface.co/spaces/brownj55/buildmaster-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/brownj55/buildmaster-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/brownj55/buildmaster-pro/resolve/main/script.js
1.89 kB
| // Main JavaScript functionality | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Smooth scroll for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Form submission handling | |
| const contactForm = document.querySelector('form'); | |
| if (contactForm) { | |
| contactForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Simple form validation | |
| const name = document.getElementById('name').value; | |
| const email = document.getElementById('email').value; | |
| const message = document.getElementById('message').value; | |
| if (!name || !email || !message) { | |
| alert('Please fill in all required fields.'); | |
| return; | |
| } | |
| // Here you would typically send the form data to a server | |
| alert('Thank you for your message! We will contact you soon.'); | |
| contactForm.reset(); | |
| }); | |
| } | |
| // Add animation classes when elements come into view | |
| const animateOnScroll = function() { | |
| const elements = document.querySelectorAll('.fade-in'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.2; | |
| if (elementPosition < screenPosition) { | |
| element.classList.add('animate-fadeIn'); | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); // Run once on page load | |
| }); |