File size: 1,818 Bytes
95554e6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | // Shared JavaScript across all pages
console.log('Peec AI Platform loaded');
// Initialize animations and interactions
document.addEventListener('DOMContentLoaded', function() {
// Add intersection observer for scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
});
// Handle smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Add loading states to buttons
document.querySelectorAll('a[href*="app.peec.ai"]').forEach(button => {
button.addEventListener('click', function() {
this.classList.add('loading');
setTimeout(() => {
this.classList.remove('loading');
}, 2000);
});
});
}
// Handle mobile menu toggle
function initMobileMenu() {
const mobileMenuButton = document.querySelector('[data-mobile-menu-button]');
const mobileMenu = document.querySelector('[data-mobile-menu]');
if (mobileMenuButton && mobileMenu) {
mobileMenuButton.addEventListener('click', function() {
mobileMenu.classList.toggle('hidden');
});
}
}
initMobileMenu();
// Performance monitoring
window.addEventListener('load', function() {
const loadTime = performance.timing.loadEventEnd - performance.timing.navigationStart;
console.log(`Page loaded in ${loadTime}ms`);
}); |