So I have a pop over div that shows when going to the site with a YouTube video auto playing in there, the problem is, if the box is closed the audio of the video still remains, is there a way to get around this with jQuery? I don't know if there is a way to stop sound from a certain element?
The code is below.
CSS
.full_page_overlay1 {
width: 100%;
height: 100%;
position: fixed;
top: 0px;
left: 0px;
background: #626262;
opacity: 0.9;
z-index: 2147483646;
}
.cart_over1 {
width: 1024px;
position: fixed;
float: left;
border: 1px solid black;
box-shadow: 1px 1px 10px black;
background: white;
z-index: 2147483647;
border-radius: 10px;
}
#close_box1 {
float: left;
top: 0px;
left: 0px;
display: table-cell;
vertical-align: middle;
width: 40px;
height: 40px;
font-size: 40px;
text-align: center;
color: black;
text-shadow: 1px 1px 3px black;
font-weight: bolder;
cursor: pointer;
margin-bottom: 10px;
}
HTML/PHP
<?php
if ($_COOKIE['video'] != 'watched') {
$value = "watched";
// send a simple cookie
setcookie("video",$value,time() + (10 * 365 * 24 * 60 * 60));
?>
<div class="full_page_overlay1"></div>
<div class="container">
<div class="cart_over1">
<div id="close_box1">X</div>
<iframe width="1024" height="600" src="//www.youtube.com/embed/zDnVDyVYiv8?autoplay=1" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<?php } ?>
And the jQuery
$( document ).ready(function() {
$("#close_box1").click(function(){
$(".full_page_overlay1").fadeOut();
$(".cart_over1").fadeOut();
})
});
Many thanks in advance for your help.