I am trying to create a youtube modal view similar to this: https://www.udacity.com/ , but in wordpress, which uses a visual composer.
I have 3 problems with this modal:
1 - When the background layer is pressed, the contents of the top navigation menu are not distributed, they are still displayed. How to make the background stretch and close the menu?
2 - The scroll bars are hidden, but the user can still scroll the wheel, and some elements down the page are displayed at the top of the pop-up layer
3. The biggest problem is closing the video and creating tooltips. The source code was fixed in size, I changed the percentage and made it work, but it looks very strange in mobile
Link to the page:
http://blacktrax.cast-soft.com/lighting-test-2/
CSS
.mm-product-video-modal-container {
position: fixed;
top: 0px;
left: 0px;
z-index: 10000;
width: 100%;
height: 100%;
background: #03070D;
display: none;
overflow: hidden;
}
.mm-product-video-modal-container.open {
display: block;
}
.mm-product-video-modal-close:hover {
cursor: pointer;
}
.mm-product-video-modal-close {
color: #fff;
position: fixed;
z-index: 1000000000;
top: 20px;
right: 20px;
font-size: 40px;
}
.mm-product-video-modal {
width: 70%;
height: 70%;
max-height: 664px;
overflow: hidden;
position: relative;
top: -1000px;
text-align: center;
vertical-align: middle;
border-radius: 4px;
}
.mm-product-video-modal.open {
top: 150px;
margin-bottom: 150px;
}
.mm-video-overlay {
position: fixed;
top: 0px;
left: 0px;
background: transparent;
width: 100%;
height: 100%;
z-index: -1;
}
.mm-launch-container {
margin-top: 2em;
}
.mm-launch {
border: none;
color: #ffff;
padding: 5px 60px;
font-size: 25px;
}
.mm-launch-container p {
text-align: justify;
font-size: 16px;
font-weight: 300;
margin-bottom: 30px;
}
.mm-launch-container h2 {
font-size: 50px;
font-weight: 800;
letter-spacing: -1px;
margin-bottom: 20px;
}
.dropper {
transition: top 0.5s ease-in-out;
}
JavaScript:
<script type="text/javascript">
function onYouTubeIframeAPIReady() {
player = new YT.Player('video-placeholder', {
width: 1180,
height: 664,
videoId: 'gZC1TOLVi60',
events: {
onReady: initialize
}
});
}
function initialize(){
}
function deployVideo() {
jQuery('.mm-product-video-modal-container').addClass('open');
setTimeout(function() {
jQuery('.mm-product-video-modal').addClass('open');
player.playVideo();
}, 250);
}
function destroyVideo() {
jQuery('.mm-product-video-modal').removeClass('open');
setTimeout(function() {
jQuery('.mm-product-video-modal-container').removeClass('open');
player.pauseVideo();
}, 250);
}
jQuery('.mm-video-overlay').on('click', function() {
destroyVideo();
});
jQuery('.mm-launch').on('click',function() {
deployVideo();
});
</script>
HTML:
<script src="https://www.youtube.com/iframe_api"></script>
<div align="center" class="mm-product-video-modal-container">
<div class="mm-product-video-modal dropper">
<div class="embed-responsive embed-responsive-16by9">
<div id="video-placeholder"></div>
</div>
</div>
<div class="mm-video-overlay"></div>
</div>
<div class="mm-launch-container container" align="center">
<div class="col-sm-offset-3 col-sm-6">
<button class="mm-launch">Launch Video</button>
</div>
</div>
This is how the code is inserted:
