JSFiddle - React, Tailwind, and code Playground
HTML
<div class="image-slider-fade fade">
<button class="_active">Play</button>
<video id="vid1" controls>
<source src="videos/testvid1.mp4" type="video/mp4">
Your browser does not support the video.
</video>
</div>
CSS
#vid1, #vid2, #vid3, #vid4 {
width: 100%;
z-index: -1;
}
button {
background-color: #666;
border: medium none;
color: #fff;
display: block;
font-size: 18px;
left: 0;
margin: 0 auto;
padding: 8px 16px;
position: absolute;
right: 0;
top: 50%;
}
button._active {
opacity: 0.5;
}
button:hover {
background-color: #e05a00;
}
JavaScript
//video play button
$(document).ready(function() {
var ctrlVideo = document.getElementById("video");
('button').click(function() {
if ($('button').hasClass("_active")) {
ctrlVideo.play();
$('button').html("Pause");
$('button').toggleClass("_active");
} else {
ctrlVideo.pause();
$('button').html("Play");
$('button').toggleClass("_active");
}
});
});