I added some javascript that triggers a pop-up with a YouTube video as shown in the image.
The code is controlled by a "a href" as shown below to trigger the pop-up. It's essentially using the display: block vs display: none (css) to show and hide the video. This code works, but I realized that the video continues to play when I close the pop-up.
Code to trigger the pop-up:
a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">
video</a>
Code to close the pop-up:
a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">
Close</a>
Is there any jquery or javascript I can add to the close part to make the video stop?
Any help is so appreciated. Thank you in advance.