mirror of https://github.com/kortix-ai/suna.git
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const mobileMenu = document.querySelector('.mobile-menu');
|
|
const navLinks = document.querySelector('.nav-links');
|
|
const contactForm = document.getElementById('contact-form');
|
|
|
|
mobileMenu.addEventListener('click', () => {
|
|
navLinks.classList.toggle('active');
|
|
mobileMenu.classList.toggle('open');
|
|
});
|
|
|
|
const smoothScroll = (target) => {
|
|
const element = document.querySelector(target);
|
|
if (element) {
|
|
element.scrollIntoView({ behavior: 'smooth' });
|
|
}
|
|
};
|
|
|
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
|
anchor.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
smoothScroll(this.getAttribute('href'));
|
|
|
|
if (navLinks.classList.contains('active')) {
|
|
navLinks.classList.remove('active');
|
|
mobileMenu.classList.remove('open');
|
|
}
|
|
});
|
|
});
|
|
|
|
contactForm.addEventListener('submit', (e) => {
|
|
e.preventDefault();
|
|
const formData = new FormData(contactForm);
|
|
const data = Object.fromEntries(formData.entries());
|
|
|
|
alert(`Thank you for your message, ${data.name}! We'll get back to you soon.`);
|
|
contactForm.reset();
|
|
});
|
|
|
|
const observerOptions = {
|
|
threshold: 0.1
|
|
};
|
|
|
|
const fadeInObserver = new IntersectionObserver((entries) => {
|
|
entries.forEach(entry => {
|
|
if (entry.isIntersecting) {
|
|
entry.target.classList.add('fade-in');
|
|
}
|
|
});
|
|
}, observerOptions);
|
|
|
|
document.querySelectorAll('.feature, .about-content, .contact-container').forEach(section => {
|
|
fadeInObserver.observe(section);
|
|
});
|
|
}); |