• 회원가입
  • 로그인

[DOM_Element] JS - requestFullscreen() 메서드 - 전체화면모드로 열기 (IE11 이상. 접두어필요)

requestFullscreen() 예제

 

<button onclick="openFullscreen();">전체화면모드 열기</button>

<p><strong>Tip:</strong> 전체화면모드 닫기 : ESC 키</p>


<video width="100%" controls id="hz">

  <source src="https://vt.tumblr.com/tumblr_o600t8hzf51qcbnq0_480.mp4" type="video/mp4">

</video>


<script>

var mp4 = document.getElementById("hz");


function openFullscreen() {

  if (mp4.requestFullscreen) {

  mp4.requestFullscreen();

  } else if (mp4.mozRequestFullScreen) { /* Firefox */

  mp4.mozRequestFullScreen();

  } else if (mp4.webkitRequestFullscreen) { /* Chrome, Safari, Opera */

  mp4.webkitRequestFullscreen();

  } else if (mp4.msRequestFullscreen) { /* IE/Edge */

  mp4.msRequestFullscreen();

  }

}

</script>

 

결과보기

 

방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

찾아주셔서 감사합니다. Since 2012