mirror of https://github.com/kortix-ai/suna.git
69 lines
2.2 KiB
JavaScript
69 lines
2.2 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const handleIntersection = (entries, observer) => {
|
|
entries.forEach(entry => {
|
|
if (entry.isIntersecting) {
|
|
entry.target.classList.add('animate');
|
|
observer.unobserve(entry.target);
|
|
}
|
|
});
|
|
};
|
|
|
|
const observerOptions = {
|
|
threshold: 0.2,
|
|
rootMargin: '0px'
|
|
};
|
|
|
|
const animationObserver = new IntersectionObserver(handleIntersection, observerOptions);
|
|
|
|
document.querySelectorAll('.feature-card, .testimonial-card').forEach(element => {
|
|
animationObserver.observe(element);
|
|
});
|
|
const hamburger = document.querySelector('.hamburger');
|
|
const navLinks = document.querySelector('.nav-links');
|
|
const links = document.querySelectorAll('.nav-links a');
|
|
|
|
hamburger.addEventListener('click', () => {
|
|
navLinks.classList.toggle('active');
|
|
});
|
|
|
|
links.forEach(link => {
|
|
link.addEventListener('click', (e) => {
|
|
e.preventDefault();
|
|
const targetId = link.getAttribute('href');
|
|
const targetSection = document.querySelector(targetId);
|
|
|
|
targetSection.scrollIntoView({
|
|
behavior: 'smooth'
|
|
});
|
|
|
|
if (window.innerWidth <= 768) {
|
|
navLinks.style.display = 'none';
|
|
}
|
|
});
|
|
});
|
|
|
|
const contactForm = document.getElementById('contact-form');
|
|
contactForm.addEventListener('submit', (e) => {
|
|
e.preventDefault();
|
|
const formData = new FormData(contactForm);
|
|
const formObject = Object.fromEntries(formData);
|
|
|
|
alert('Message sent successfully!');
|
|
contactForm.reset();
|
|
});
|
|
|
|
const observer = new IntersectionObserver((entries) => {
|
|
entries.forEach(entry => {
|
|
if (entry.isIntersecting) {
|
|
entry.target.style.opacity = '1';
|
|
entry.target.style.transform = 'translateY(0)';
|
|
}
|
|
});
|
|
}, { threshold: 0.1 });
|
|
|
|
document.querySelectorAll('.feature-card').forEach(card => {
|
|
card.style.opacity = '0';
|
|
card.style.transform = 'translateY(20px)';
|
|
observer.observe(card);
|
|
});
|
|
}); |