H5点击按钮,实现浏览器全屏模式代码

<button class="fullBtn">点击实现全屏</button>
$('.fullBtn').on('click', function() {

var docElm = document.documentElement;
         // W3C
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
}
// FireFox
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
}
// Chrome等
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
// IE11
else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
});

posted on 2017-08-31 16:37  flsummer  阅读(360)  评论(0编辑  收藏  举报

导航