JSFiddle - React, Tailwind, and code Playground
HTML
<div class="buttons">
<div class="show-button">Show</div>
<div id="infoToggler">
<div class="play-button">Play</div>
<div class="pause-button">Pause</div>
</div>
<div class="exit-button">Exit</div>
</div>
<div class="video-large">
<video id="video-2">
<source src="https://www.bigcartel.com/videos/bgvid-1280x720-rf25-d0e7eb9e.mp4v" type="video/mp4" />
</video>
</div>
CSS
body {
margin: 0;
background: #000;
}
video {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: url(http://demosthenes.info/assets/images/polina.jpg) no-repeat;
background-size: cover;
}
.buttons {
position:fixed;
top:0;
right: 0;
}
.video-large {
display: none;
}
.show-button {
width:50px;
height:50px;
background-color:#000;
display:block;
cursor:pointer;
float:left;
color: #fff;
text-align:center;
line-height:50px;
}
.play-button {
width:50px;
height:50px;
background-color:green;
display:none;
cursor:pointer;
float:left;
color: #fff;
text-align:center;
line-height:50px;
}
.pause-button {
width:50px;
height:50px;
background-color:blue;
display:none;
cursor:pointer;
float:left;
color: #fff;
text-align:center;
line-height:50px;
}
.exit-button {
width:50px;
height:50px;
background-color:red;
display:none;
cursor:pointer;
float:left;
color: #fff;
text-align:center;
line-height:50px;
}
JavaScript
$('.show-button').on('click', function () {
// Just go ahead and pause/reset all the video elements
$('#video-2')[0].play();
$('.video-large').fadeIn(400).show();
$('.pause-button').fadeIn(400).show();
$('.exit-button').fadeIn(400).show();
$('#video-1')[0].pause();
});
$('.exit-button').on('click', function () {
$('.video-large').fadeOut(400).hide();
$('.pause-button').hide();
$('.exit-button').hide();
$('.play-button').hide();
$('#video-1')[0].play();
});
$("#infoToggler").click(function () {
$(this).find('div').toggle();
});
$('.pause-button').on('click', function () {
$('#video-2')[0].pause();
});
$('.play-button').on('click', function () {
$('#video-2')[0].play();
});
var vid = document.getElementById("video-2");
vid.volume = 0.5;