Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!