I have the following html.
<div id="video-popup-overlay"></div>
<div id="video-popup-container">
<div id="video-popup-close" class="fade"><i class="fa fa-times"></i></div>
<div id="video-popup-iframe-container">
<iframe id="video-popup-iframe" src="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
</div>
Basically I have a video playing when the #video-popup-container
is showing. I want to be able to hide this video. But normally when the element is hidden, the video still plays in the background.
That is why I want to change the src. But when I change the src, the elements don't hide. But the hide commands work if I don't change the src.
Is there a reason this would be happening?
$("#video-popup-close, #video-popup-overlay").on('click', function(e){
$("#video-popup-iframe").attr('src', "");
$("#video-popup-overlay").hide();
$("#video-popup-container").hide();
});