The flip card component creates an interactive 3D gallery where images flip to reveal inspirational stories and testimonials. This component is used extensively in the Voluntariado and Clow sections to showcase impact stories.
<div class="galeria-item"> <div class="galeria-flip-card"> <!-- Front of card (image) --> <div class="galeria-flip-front"> <img src="./img voluntario/img2.png" alt="Voluntarios ayudando"> <div class="galeria-overlay"> <p>Juntos Somos Más Fuertes</p> </div> </div> <!-- Back of card (story) --> <div class="galeria-flip-back"> <div class="galeria-historia"> <p class="historia-titulo">🤝 Comunidad</p> <p class="historia-texto">"Un voluntario es fuerte, pero una comunidad de voluntarios es invencible. Trabajamos juntos para crear un impacto tan grande que ningún niño se sienta abandonado."</p> <p class="historia-autor">— Misión Siloé</p> </div> </div> </div></div>
<section class="galeria-impacto"> <h2>Historias que Transforman Vidas</h2> <p class="galeria-subtitulo">Cada momento cuenta. Cada sonrisa importa.</p> <div class="galeria-grid"> <!-- Multiple galeria-item elements here --> </div></section>
document.addEventListener('DOMContentLoaded', function() { // Select all flip cards const flipCards = document.querySelectorAll('.galeria-flip-card'); let currentFlipped = null; // Track currently flipped card // Add click listener to each card flipCards.forEach(card => { card.addEventListener('click', function() { // If there's a different card already flipped, flip it back if (currentFlipped && currentFlipped !== this) { currentFlipped.classList.remove('flipped'); } // Toggle the 'flipped' class on clicked card this.classList.toggle('flipped'); // Update reference to currently flipped card if (this.classList.contains('flipped')) { currentFlipped = this; } else { currentFlipped = null; } }); });});
The JavaScript ensures only one card is flipped at a time. Clicking a new card automatically flips the previous one back.
<div class="galeria-flip-back"> <div class="galeria-historia"> <p class="historia-titulo">🎯 Title</p> <p class="historia-texto">"Your story or quote goes here. Make it meaningful and inspiring."</p> <p class="historia-autor">— Author Name</p> </div></div>
4
Optional: Make it large
For featured cards, add the galeria-item-grande class:
<div class="galeria-item galeria-item-grande"> <!-- Will span 2x2 grid cells on desktop --></div>