JavaScript 跨平台全屏API简单包装:Screenful.js
jopen
10年前
JavaScript 跨平台全屏API简单包装:Screenful.js。它可以让你把网页或任何元素放大到全屏。掩盖了不同浏览器之间的实现差异。
document.fullscreenEnabled = document.fullscreenEnabled || document.mozFullScreenEnabled || document.documentElement.webkitRequestFullScreen; function requestFullscreen(element) { if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if (element.webkitRequestFullScreen) { element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); } } if (document.fullscreenEnabled) { requestFullscreen(document.documentElement); } // Actually it's more if you want it to work in Safari, but let's not go there...