File size: 610 Bytes
a2488a3 0d1ea40 a2488a3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function toggleCard(element) {
// Check if clicked card is already expanded
const isExpanded = element.classList.contains('expanded');
// Close all other cards first (Accordion behavior)
document.querySelectorAll('.era-card').forEach(card => {
card.classList.remove('expanded');
});
// If it wasn't expanded, expand it now
if (!isExpanded) {
element.classList.add('expanded');
// Smooth scroll to the expanded card
setTimeout(() => {
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300);
}
} |