AI update: עדכן את טופס יצירת הקשר (Contact Form) כך שכתובת המייל שאליה נשלחות הפניות תהיה: support@emilion.co.il
אם יש כתובת מייל
This commit is contained in:
@@ -51,29 +51,41 @@ window.addEventListener('scroll', () => {
|
||||
}
|
||||
});
|
||||
|
||||
menuToggle.addEventListener('click', () => {
|
||||
function toggleMobileMenu() {
|
||||
const isOpen = mobileMenu.classList.contains('active');
|
||||
|
||||
menuToggle.classList.toggle('active');
|
||||
mobileMenu.classList.toggle('active');
|
||||
document.body.style.overflow = mobileMenu.classList.contains('active') ? 'hidden' : '';
|
||||
});
|
||||
|
||||
// Update ARIA attributes
|
||||
menuToggle.setAttribute('aria-expanded', !isOpen);
|
||||
mobileMenu.setAttribute('aria-hidden', isOpen);
|
||||
|
||||
document.body.style.overflow = !isOpen ? 'hidden' : '';
|
||||
}
|
||||
|
||||
function closeMobileMenu() {
|
||||
menuToggle.classList.remove('active');
|
||||
mobileMenu.classList.remove('active');
|
||||
menuToggle.setAttribute('aria-expanded', 'false');
|
||||
mobileMenu.setAttribute('aria-hidden', 'true');
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
|
||||
menuToggle.addEventListener('click', toggleMobileMenu);
|
||||
|
||||
mobileLinks.forEach(link => {
|
||||
link.addEventListener('click', () => {
|
||||
menuToggle.classList.remove('active');
|
||||
mobileMenu.classList.remove('active');
|
||||
document.body.style.overflow = '';
|
||||
});
|
||||
link.addEventListener('click', closeMobileMenu);
|
||||
});
|
||||
|
||||
// Reveal on Scroll
|
||||
const reveals = document.querySelectorAll('.reveal');
|
||||
|
||||
const revealObserver = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry, index) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
setTimeout(() => {
|
||||
entry.target.classList.add('visible');
|
||||
}, index * 100);
|
||||
entry.target.classList.add('visible');
|
||||
revealObserver.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, {
|
||||
@@ -116,38 +128,80 @@ if (statsSection) {
|
||||
statsObserver.observe(statsSection);
|
||||
}
|
||||
|
||||
// Form Handling
|
||||
// Form Handling with actual submission
|
||||
const contactForm = document.getElementById('contactForm');
|
||||
|
||||
if (contactForm) {
|
||||
contactForm.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
const submitBtn = contactForm.querySelector('button[type="submit"]');
|
||||
const originalBtnHTML = submitBtn.innerHTML;
|
||||
|
||||
// Client-side validation
|
||||
function validateForm() {
|
||||
let isValid = true;
|
||||
const requiredFields = contactForm.querySelectorAll('[required]');
|
||||
|
||||
const btn = contactForm.querySelector('button[type="submit"]');
|
||||
const originalText = btn.innerHTML;
|
||||
|
||||
btn.innerHTML = '<span>שולח...</span>';
|
||||
btn.disabled = true;
|
||||
|
||||
setTimeout(() => {
|
||||
btn.innerHTML = '<span>נשלח בהצלחה! ✓</span>';
|
||||
btn.style.background = 'var(--color-success)';
|
||||
requiredFields.forEach(field => {
|
||||
const errorSpan = field.parentElement.querySelector('.form-error');
|
||||
field.classList.remove('error');
|
||||
if (errorSpan) errorSpan.textContent = '';
|
||||
|
||||
setTimeout(() => {
|
||||
btn.innerHTML = originalText;
|
||||
btn.style.background = '';
|
||||
btn.disabled = false;
|
||||
contactForm.reset();
|
||||
}, 3000);
|
||||
}, 1500);
|
||||
if (!field.value.trim()) {
|
||||
isValid = false;
|
||||
field.classList.add('error');
|
||||
if (errorSpan) errorSpan.textContent = 'שדה חובה';
|
||||
} else if (field.type === 'email' && !isValidEmail(field.value)) {
|
||||
isValid = false;
|
||||
field.classList.add('error');
|
||||
if (errorSpan) errorSpan.textContent = 'כתובת אימייל לא תקינה';
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function isValidEmail(email) {
|
||||
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
||||
}
|
||||
|
||||
contactForm.addEventListener('submit', (e) => {
|
||||
if (!validateForm()) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
// Show loading state but let the form submit naturally
|
||||
submitBtn.innerHTML = '<span>שולח...</span>';
|
||||
submitBtn.disabled = true;
|
||||
});
|
||||
|
||||
// Real-time validation on blur
|
||||
contactForm.querySelectorAll('input, textarea').forEach(field => {
|
||||
field.addEventListener('blur', () => {
|
||||
if (field.hasAttribute('required')) {
|
||||
const errorSpan = field.parentElement.querySelector('.form-error');
|
||||
field.classList.remove('error');
|
||||
if (errorSpan) errorSpan.textContent = '';
|
||||
|
||||
if (!field.value.trim()) {
|
||||
field.classList.add('error');
|
||||
if (errorSpan) errorSpan.textContent = 'שדה חובה';
|
||||
} else if (field.type === 'email' && !isValidEmail(field.value)) {
|
||||
field.classList.add('error');
|
||||
if (errorSpan) errorSpan.textContent = 'כתובת אימייל לא תקינה';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Smooth Scroll for Navigation Links
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
const href = this.getAttribute('href');
|
||||
if (href === '#') return;
|
||||
|
||||
e.preventDefault();
|
||||
const target = document.querySelector(this.getAttribute('href'));
|
||||
const target = document.querySelector(href);
|
||||
if (target) {
|
||||
const navHeight = nav.offsetHeight;
|
||||
const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - navHeight;
|
||||
@@ -160,7 +214,7 @@ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
});
|
||||
|
||||
// Parallax effect on hero orbs
|
||||
const orbs = document.querySelectorAll('.gradient-orb');
|
||||
const orbs = document.querySelectorAll('.hero-bg .gradient-orb');
|
||||
|
||||
if (window.matchMedia('(prefers-reduced-motion: no-preference)').matches) {
|
||||
window.addEventListener('scroll', () => {
|
||||
|
||||
Reference in New Issue
Block a user