Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

256
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda