“HTML Video Tag Play Button Overlay” Kode Jawaban

HTML Video Tag Play Button Overlay

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%;
}
Jonathan López Iglesias

HTML Video Tag Play Button Overlay

<button class="active">play</button>
<video id="banner-video" preload="auto" loop>
	<source src="https://static.videezy.com/system/resources/previews/000/002/719/original/cloudy-sunset.mp4">
</video>
Jonathan López Iglesias

HTML Video Tag Play Button Overlay

video {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
  z-index: -1;
  -webkit-transition: all 1s;
  -moz-transition: all 1s;
  -o-transition: all 1s;
  transition: all 1s;
}
Jonathan López Iglesias

HTML Video Tag Play Button Overlay

$( 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");
  }
});
});
Jonathan López Iglesias

Jawaban yang mirip dengan “HTML Video Tag Play Button Overlay”

Pertanyaan yang mirip dengan “HTML Video Tag Play Button Overlay”

Lebih banyak jawaban terkait untuk “HTML Video Tag Play Button Overlay” di HTML

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya