// 全屏事件
handleFullScreen(id) {
let element = document.getElementById(id); //需要全屏容器的id
// 浏览器兼容
if (this.fullscreen) {
// 取消全屏
if (document.exitFullscreen && document.fullscreenElement !== null) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
} else {
// 全屏
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
this.fullscreen = !this.fullscreen;
},
标签:fullscreen,document,else,全屏,element,id,事件 From: https://www.cnblogs.com/liyunxi/p/18065503