AI update: עדכן את טופס צור קשר כך שכל ההודעות יישלחו לכתובת המייל: yossi.em@gmail.com
וודא שזו הכתובת המוגדרת בכל מקום שיש אפשרות
This commit is contained in:
@@ -119,44 +119,6 @@
|
||||
revealElements.forEach(el => el.classList.add('visible'));
|
||||
}
|
||||
|
||||
// Form submission
|
||||
const contactForm = document.querySelector('.contact-form');
|
||||
|
||||
if (contactForm) {
|
||||
contactForm.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const btn = contactForm.querySelector('.btn');
|
||||
const btnText = btn.querySelector('span');
|
||||
const originalText = btnText.textContent;
|
||||
|
||||
// Basic validation
|
||||
const name = contactForm.querySelector('#name');
|
||||
const email = contactForm.querySelector('#email');
|
||||
|
||||
if (!name.value.trim() || !email.value.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable button
|
||||
btn.disabled = true;
|
||||
btnText.textContent = 'שולח...';
|
||||
|
||||
// Simulate send (replace with actual form handling)
|
||||
setTimeout(() => {
|
||||
btnText.textContent = 'נשלח בהצלחה! ✓';
|
||||
btn.style.background = 'linear-gradient(135deg, #00b894 0%, #55efc4 100%)';
|
||||
|
||||
setTimeout(() => {
|
||||
btnText.textContent = originalText;
|
||||
btn.style.background = '';
|
||||
btn.disabled = false;
|
||||
contactForm.reset();
|
||||
}, 3000);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
// Smooth scroll for anchor links
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', (e) => {
|
||||
@@ -177,4 +139,52 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Form submission handling with feedback
|
||||
const contactForm = document.getElementById('contact-form');
|
||||
const formStatus = document.getElementById('form-status');
|
||||
|
||||
if (contactForm && formStatus) {
|
||||
contactForm.addEventListener('submit', function(e) {
|
||||
const submitBtn = contactForm.querySelector('button[type="submit"]');
|
||||
const originalText = submitBtn.querySelector('span').textContent;
|
||||
|
||||
// Show loading state
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.querySelector('span').textContent = 'שולח...';
|
||||
|
||||
// FormSubmit handles the actual submission
|
||||
// We add a listener for successful redirect or show error after timeout
|
||||
|
||||
// Since FormSubmit redirects by default, we'll use fetch for better UX
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(contactForm);
|
||||
|
||||
fetch(contactForm.action, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
formStatus.textContent = 'ההודעה נשלחה בהצלחה! נחזור אליכם בהקדם.';
|
||||
formStatus.className = 'form-status success';
|
||||
contactForm.reset();
|
||||
} else {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
formStatus.textContent = 'אירעה שגיאה בשליחת ההודעה. אנא נסו שוב או צרו קשר במייל.';
|
||||
formStatus.className = 'form-status error';
|
||||
})
|
||||
.finally(() => {
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.querySelector('span').textContent = originalText;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user