File size: 1,100 Bytes
99e3611 | 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 |
document.addEventListener('DOMContentLoaded', function() {
// Initialize animations
const cards = document.querySelectorAll('custom-news-card');
cards.forEach((card, index) => {
card.classList.add('animate-fade-in');
card.classList.add(`delay-${(index % 3) * 100}`);
});
// Add clone indicator
const hero = document.querySelector('.bg-gradient-to-r');
if (hero) {
const cloneBadge = document.createElement('div');
cloneBadge.className = 'absolute top-4 right-4 bg-yellow-500 text-white px-3 py-1 rounded-full text-xs font-bold';
cloneBadge.textContent = 'CLONE';
hero.appendChild(cloneBadge);
}
});
// Intersection Observer for lazy loading and animations
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fade-in');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.1
});
document.querySelectorAll('.observe-me').forEach(el => {
observer.observe(el);
}); |