34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
// Car Sales Afghanistan - App Scripts
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const header = document.querySelector('header');
|
|
|
|
// Header scroll effect
|
|
window.addEventListener('scroll', () => {
|
|
if (window.scrollY > 50) {
|
|
header.style.background = 'rgba(15, 15, 18, 0.95)';
|
|
header.style.boxShadow = '0 4px 20px rgba(0,0,0,0.5)';
|
|
} else {
|
|
header.style.background = 'rgba(15, 15, 18, 0.8)';
|
|
header.style.boxShadow = 'none';
|
|
}
|
|
});
|
|
|
|
// Simple fade-in animation for cards
|
|
const cards = document.querySelectorAll('.glass-card');
|
|
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 });
|
|
|
|
cards.forEach(card => {
|
|
card.style.opacity = '0';
|
|
card.style.transform = 'translateY(20px)';
|
|
card.style.transition = 'all 0.6s ease-out';
|
|
observer.observe(card);
|
|
});
|
|
});
|