0

I'm trying to find the iframe tag in order to open a popup window. If I use the <video> tag it works fine but when I use iframe tag it does not. What is the problem?

<div class="about__img-overlay">
  <div class="video3">
    <iframe src="https://player.vimeo.com/video/807322046?h=0d933f4470&autoplay=1&loop=1&title=0&byline=0&controls=0&muted=1" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" class="about__img-one"></iframe>
  </div>
</div>
document.querySelectorAll('.video-container iframe').forEach(vid => {
  vid.onclick = () => {
    document.querySelector('.popup-video').style.display = 'block';
  }
});
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Orestis_M
  • 9
  • 5
  • As it's a cross-domain iframe you cannot interact with it. This is a security limitation – Rory McCrossan Jun 01 '23 at 10:58
  • Click events in documents loaded in iframes bubble up to the top of those documents then stop. They don't continue bubbling through the iframe into the parent document. – Quentin Jun 01 '23 at 11:00

0 Answers0