Spaces:
Running
Running
File size: 1,526 Bytes
0a1d0f6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
// Show/hide sticky CTA based on scroll position
window.addEventListener('scroll', function() {
const stickyCta = document.getElementById('sticky-cta');
const contactSection = document.getElementById('contact-form');
// Show sticky CTA when scrolled past hero section
if (window.scrollY > window.innerHeight * 0.5) {
stickyCta.classList.remove('translate-y-full');
} else {
stickyCta.classList.add('translate-y-full');
}
// Hide sticky CTA when reaching contact form
const contactRect = contactSection.getBoundingClientRect();
if (contactRect.top <= window.innerHeight && contactRect.bottom >= 0) {
stickyCta.classList.add('translate-y-full');
}
});
// Smooth scroll to contact form
function scrollToForm() {
document.getElementById('contact-form').scrollIntoView({
behavior: 'smooth'
});
}
// Form submission handling
document.getElementById('trailer-form').addEventListener('submit', function(e) {
e.preventDefault();
// Get form values
const formData = {
name: document.getElementById('name').value,
email: document.getElementById('email').value,
logline: document.getElementById('logline').value
};
// In a real application, you would send this data to your server
console.log('Form submitted:', formData);
// Show success message
alert('Thank you! I\'ll get back to you within 24 hours to discuss your project.');
// Reset form
this.reset();
}); |