HTML
xxxxxxxxxx
1
<div class="container-fluid mt-3 mb-5">
2
3
<section style="background-image: url('https://mdbootstrap.com/img/Photos/Horizontal/Work/12-col/img%20(1).jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center;">
4
5
<!-- Modal -->
6
<div class="modal fade" id="modal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
7
aria-hidden="true">
8
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
9
<div class="modal-content">
10
<div class="embed-responsive embed-responsive-16by9 z-depth-1-half">
11
<iframe id="player" class="embed-responsive-item" src="https://www.youtube.com/embed/7MUISDJ5ZZ4" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
12
</div>
13
</div>
14
</div>
15
</div>
16
17
<div class="mask rgba-black-strong py-5">
18
19
<div class="container text-center my-5">
20
21
<h3 class="font-weight-bold text-center white-text pb-2">Watch Video</h3>
22
<hr class="w-header hr-light my-4">
23
<p class="lead text-center white-text pt-2 mb-5">Explore the best MDB template in the market in a short 1-minute video.</p>
24
25
<a id="play" class="btn-floating btn-cyan btn-lg" data-toggle="modal" data-target="#modal1"><i class="fas fa-play"></i></a>
26
27
</div>
28
29
</div>
30
31
</section>
32
33
</div>
CSS
1
1
JS
xxxxxxxxxx
1
$('#play').on('click', function (e) {
2
e.preventDefault();
3
$("#player")[0].src += "?autoplay=1";
4
$('#player').show();
5
$('#video-cover').hide();
6
})
7
$('#modal1').on('hidden.bs.modal', function (e) {
8
$('#modal1 iframe').attr("src", $("#modal1 iframe").attr("src"));
9
});
Console errors: 0