<div id="wrap">
<!-- section -->
<div class="section">
<div class="center">
<div id="video">
<div class="video-control" id="video-play"></div>
<div class="video-control" id="video-over"></div>
<video id="myVideo" preload="auto" poster="http://media.w3.org/2010/05/sintel/poster.png">
<source id='mp4' src="http://media.w3.org/2010/05/sintel/trailer.mp4" type='video/mp4' />
<source id='webm' src="http://media.w3.org/2010/05/sintel/trailer.webm" type='video/webm' />
<source id='ogv' src="http://media.w3.org/2010/05/sintel/trailer.ogv" type='video/ogg' />
</video>
</div>
</div>
</div>
<!--/section -->
</div>
html,
body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: 16px;
line-height: 1.4;
color: #555;
background: #fff;
}
* {
box-sizing: border-box;
}
#wrap {
position: relative;
}
.section {
padding: 40px 20px;
border-bottom: 1px solid #ddd;
&:last-child {
border-bottom: 0;
}
&--d {
background: #000;
}
}
.center {
width: 100%;
max-width: 980px;
margin: auto;
}
#video {
width: 100%;
position: relative;
&-over {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
display: none;
}
&-play {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
width: 56px;
height: 56px;
border-radius: 50%;
box-shadow: 0 0 0 4px #fff;
z-index: 1;
cursor: pointer;
transition: .2s ease;
transition-property: opacity, visibility;
&::before {
content: '';
display: block;
position: absolute;
top: 0;
bottom: 0;
margin: auto;
left: 21px;
width: 0;
height: 0;
border: 20px solid transparent;
border-top-width: 12px;
border-bottom-width: 12px;
border-left-color: #fff;
border-right-width: 0;
transition: transform .2s ease;
}
&:hover {
&::before {
transform: scale(1.2);
}
}
}
video {
width: 100%;
display: block;
}
&.video-is-playing {
#video {
&-over {
display: block;
}
&-play {
opacity: 0;
visibility: hidden;
}
}
}
}
View Compiled
$(function () {
var $videoContainer = $('#video'),
$videoControls = $('.video-control'),
$video = $('#myVideo')[0];
$videoControls.click(function () {
if ($video.paused) {
$video.play();
$videoContainer.addClass('video-is-playing');
} else {
$video.pause();
$videoContainer.removeClass('video-is-playing');
// set the poster back
$video.load();
}
});
});
This Pen doesn't use any external CSS resources.