css 全屏API - HTML5 API - http://www.starstormdesign.de/fullscreen-api-html5/

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 全屏API - HTML5 API - http://www.starstormdesign.de/fullscreen-api-html5/相关的知识,希望对你有一定的参考价值。

if (
  document.fullscreenEnabled ||
  document.webkitFullscreenEnabled ||
  document.mozFullScreenEnabled ||
  document.msFullscreenEnabled
) {
  // Das API ist verfügbar.
}
var img = document.getElementById("my-image");
 
// Bild im Vollbild öffnen
if (img.requestFullscreen) {
  img.requestFullscreen();
} else if (img.webkitRequestFullscreen) {
  img.webkitRequestFullscreen();
} else if (img.mozRequestFullScreen) {
  img.mozRequestFullScreen();
} else if (img.msRequestFullscreen) {
  img.msRequestFullscreen();
}
if(document.exitFullscreen) {
  document.exitFullscreen();
} else if(document.webkitExitFullscreen) {
  document.webkitExitFullscreen();
} else if(document.mozCancelFullScreen) {
  document.mozCancelFullScreen();
} else if(document.msExitFullscreen) {
  document.msExitFullscreen();
}
document.addEventListener("fullscreenchange", fullscreenStatusChangedHandler);
document.addEventListener("webkitfullscreenchange", fullscreenStatusChangedHandler);
document.addEventListener("mozfullscreenchange", fullscreenStatusChangedHandler);
document.addEventListener("MSFullscreenChange", fullscreenStatusChangedHandler);

document.addEventListener("fullscreenerror", fullscreenErrorHandler);
document.addEventListener("webkitfullscreenerror", fullscreenErrorHandler);
document.addEventListener("mozfullscreenerror", fullscreenErrorHandler);
document.addEventListener("MSFullscreenError", fullscreenErrorHandler);
:-webkit-full-screen,
:-moz-full-screen,
:-ms-fullscreen,
:fullscreen {
  /* Eigenschaften */
}

::backdrop,
::-ms-backdrop {
  /* Eigenschaften */
}

以上是关于css 全屏API - HTML5 API - http://www.starstormdesign.de/fullscreen-api-html5/的主要内容,如果未能解决你的问题,请参考以下文章

HTML5 API详解:fullscreen全屏模式

全屏api HTML5和Safari(iOS 6)

带有 HTML5 视频 (javascript/jQuery) 的 Firefox/Gecko 全屏 API

HTML5 Video API - 全屏无法在 iPad 上使用 chrome/safari

HTML5新增API,移动端Web布局

使用html5中video自定义播放器必备知识点总结以及JS全屏API介绍