mirror of https://github.com/kortix-ai/suna.git
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const mobileMenu = document.querySelector('.mobile-menu');
|
|
const navLinks = document.querySelector('.nav-links');
|
|
|
|
mobileMenu.addEventListener('click', () => {
|
|
mobileMenu.classList.toggle('active');
|
|
navLinks.classList.toggle('active');
|
|
});
|
|
|
|
const links = document.querySelectorAll('a[href^="#"]');
|
|
links.forEach(link => {
|
|
link.addEventListener('click', (e) => {
|
|
e.preventDefault();
|
|
const target = document.querySelector(link.getAttribute('href'));
|
|
if (target) {
|
|
target.scrollIntoView({
|
|
behavior: 'smooth',
|
|
block: 'start'
|
|
});
|
|
if (mobileMenu.classList.contains('active')) {
|
|
mobileMenu.classList.remove('active');
|
|
navLinks.classList.remove('active');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
const observerOptions = {
|
|
threshold: 0.1,
|
|
rootMargin: '0px'
|
|
};
|
|
|
|
const observer = new IntersectionObserver((entries) => {
|
|
entries.forEach(entry => {
|
|
if (entry.isIntersecting) {
|
|
entry.target.classList.add('animate');
|
|
}
|
|
});
|
|
}, observerOptions);
|
|
|
|
document.querySelectorAll('.feature-card').forEach(card => {
|
|
observer.observe(card);
|
|
});
|
|
});
|
|
|
|
window.addEventListener('scroll', () => {
|
|
const header = document.querySelector('header');
|
|
if (window.scrollY > 50) {
|
|
header.classList.add('scrolled');
|
|
} else {
|
|
header.classList.remove('scrolled');
|
|
}
|
|
}); |