index.html
<!DOCTYPE html>
<html>
<head>
<title>Hancie e-Learning Studio</title>
<!-- Styles -->
<link rel="stylesheet" href="resource/yt-video-background.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<style>
h1, p {
margin: 0;
padding: 0;
}
.demo-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.4);
border-radius: 8px;
padding: 32px 16px 32px 16px;
color: #fff;
font-family: 'Roboto', sans-serif;
text-align: center;
}
</style>
</head>
<body>
<div class="video-background"></div>
<div class="demo-box">
<h1>YouTube Video Background</h1>
<br>
<p>With Mobile Fallback</p>
</div>
<!-- Scripts -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" ></script>
<script src="resource/yt-video-background.min.js" charset="utf-8"></script>
<script type="text/javascript">
$('.video-background').youtubeBackground({
videoId: 'y1yrZ3OfRNQ&t',
backgroundColor: '#212121',
backgroundImage: 'https://i.ytimg.com/vi/ITpIv6Efz8Y/maxresdefault.jpg', // For mobile devices
opacity: 0.6
});
</script>
</body>
</html>