Home > Software engineering >  How to load pop-up ad inside an iframe
How to load pop-up ad inside an iframe

Time:02-10

I'm implementing pop up ads for my site. The popup opens when clicked anywhere on the site except on iframe. Why does this happen? Sure iframe is separate from the entire website but why does it prevent a pop up from loading? Is there anyway to load pop-up ad inside an iframe i.e when someone press yt play button

CodePudding user response:

YT will not allow anyone to use its play button with a event listener. So, you have to make a <div ></div> make its position: absolute; and z-index: (any bigger value) and then put it in front of the play button and then if anyone tries to click on paly button of your video he will click on the div which will show a ad and when some closes the ad then make .play{ display: none;} and now your div will be removed so the person would be able to click on the play button and see the video.

  •  Tags:  
  • Related