退出全屏
var exitFullScreen = function() {
var e = document;
e.exitFullscreen ? e.exitFullscreen() : e.mozCancelFullScreen ? e.mozCancelFullScreen() : e.webkitCancelFullScreen && e.webkitCancelFullScreen()
}
全屏显示
var openFullScreen = function() {
var e = document.documentElement;
if (e.requestFullscreen)
e.requestFullscreen();
else if (e.mozRequestFullScreen)
e.mozRequestFullScreen();
else if (e.webkitRequestFullScreen)
e.webkitRequestFullScreen();
else if ("undefined" != typeof window.ActiveXObject) {
var t = new ActiveXObject("WScript.Shell");
t && t.SendKeys("{F11}")
}
}
PS:大家可以微信添加订阅号“冷星学前端”,同步更新文章内容