Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
On click of item in for loop show other element in for loop

What I have is a for loop that shows podcast items. Each podcast item has a iframe with a Spotify embed. When you click on the podcast item, the podcast item should go invisible and the Spotify embed should pop up. I can kind of do this in css by using:

iframe {
    display: none;
}

.podcast_item:active ~ iframe {
    display: block;
}

.podcast_item:active {
    display: none;
}

But when I do this, because of doing the active, it really bugs, because the spotify embed doesn't stay visible. My question is, how do I achieve this by using Javascript?

Code for the podcast item and spotify embed:

<div
  v-for="(podcast, index) in content.podcasts"
  :key="index"
  class="swiper-slide"
>
  <PodcastsItem
    :imageUrl="podcast.image"
    :title="podcast.name
    :text="'Duur: ' + podcast.id + ' ms'"
    class="podcast_item"
  />
  <iframe
    style="border-radius:12px"
    :src="
    'https://open.spotify.com/embed/episode/' + podcast.id + '?utm_source=generator'"
    width="100%"
    height="232"
    frameBorder="0"
    allowfullscreen=""
    allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
  ></iframe>
</div>

What I have right now: Each postcast item has a spotify embed under it that is invisible

Expected result: When you click on a podcast item, the right iframe shows up under the podcast item, for example if you click the second podcast item, the second spotify embed shows up.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda