backup antes da troca do CTA
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
/* Preloader */
|
||||
const preload = document.getElementById('preload');
|
||||
if (preload) {
|
||||
window.addEventListener('load', () => {
|
||||
preload.style.opacity = '0';
|
||||
preload.style.transition = 'opacity 0.4s ease';
|
||||
setTimeout(() => {
|
||||
preload.style.display = 'none';
|
||||
}, 400);
|
||||
});
|
||||
}
|
||||
|
||||
/* Menu Mobile Toggle */
|
||||
const mobileToggle = document.getElementById('mobile-toggle');
|
||||
const mainNav = document.getElementById('main-nav');
|
||||
|
||||
if (mobileToggle && mainNav) {
|
||||
mobileToggle.addEventListener('click', () => {
|
||||
mainNav.classList.toggle('active');
|
||||
mobileToggle.classList.toggle('open');
|
||||
});
|
||||
}
|
||||
|
||||
/* Submenus Mobile */
|
||||
const parentMenuItems = document.querySelectorAll('.menu-item-has-children > a');
|
||||
parentMenuItems.forEach(item => {
|
||||
item.addEventListener('click', (e) => {
|
||||
if (window.innerWidth <= 991) {
|
||||
e.preventDefault();
|
||||
const parent = item.parentElement;
|
||||
parent.classList.toggle('open');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Formulário de Contato com Redirecionamento */
|
||||
const contactForm = document.getElementById('contact-form');
|
||||
const responseContainer = document.getElementById('contact-content');
|
||||
|
||||
if (contactForm && responseContainer) {
|
||||
contactForm.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(contactForm);
|
||||
responseContainer.innerHTML = '<div class="thanks loading">Sending message...</div>';
|
||||
|
||||
fetch(contactForm.getAttribute('action'), {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
if (data.trim() === 'REDIRECT:thankyou.html') {
|
||||
window.location.href = 'thankyou.html';
|
||||
} else {
|
||||
responseContainer.innerHTML = data;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
responseContainer.innerHTML = '<div class="thanks failure">An error occurred while sending your message. Please try again.</div>';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user