Element.requestFullscreen()方法
Posted gongxiansheng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Element.requestFullscreen()方法相关的知识,希望对你有一定的参考价值。
亲测
IE浏览器仅 IE11 支持
document.getElementById("fullScreen").onclick = function() { if (document.documentElement.RequestFullScreen) { document.documentElement.RequestFullScreen(); } //兼容火狐 console.log(document.documentElement.msRequestFullscreen) if (document.documentElement.mozRequestFullScreen) { console.log(‘火狐‘) document.documentElement.mozRequestFullScreen(); } //兼容谷歌等可以webkitRequestFullScreen也可以webkitRequestFullscreen if (document.documentElement.webkitRequestFullScreen) { console.log(‘谷歌‘) document.documentElement.webkitRequestFullScreen(); } //兼容IE,只能写msRequestFullscreen if (document.documentElement.msRequestFullscreen) { console.log(‘ie‘) document.documentElement.msRequestFullscreen(); } } document.getElementById("fullScreenNormal").onclick = function() { if (document.exitFullScreen) { document.exitFullscreen() } //兼容火狐 console.log(document.mozExitFullScreen) if (document.mozCancelFullScreen) { document.mozCancelFullScreen() } //兼容谷歌等 if (document.webkitExitFullscreen) { document.webkitExitFullscreen() } //兼容IE if (document.msExitFullscreen) { document.msExitFullscreen() } }
以上是关于Element.requestFullscreen()方法的主要内容,如果未能解决你的问题,请参考以下文章