js to make an element of the page full screen (such as video)

<video src="a.mp4" muted autoplay></video>      <a onclick="openFullscreen();">full</a>     <script>  var elem = document.getElementsByTagName("video")[0];  function openFullscreen() {   if (elem.requestFullscreen) {     elem.requestFullscreen();   } else if (elem.mozRequestFullScreen) { /* Firefox */     elem.mozRequestFullScreen();   } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */     elem.webkitRequestFullscreen();   }

The post js method to make an element of a page fullscreen (such as a video) first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/9377
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment