// 进入全屏
const requestFullscreen = () => {
const docElm = document.documentElement
//W3C
if (docElm.requestFullscreen) {
docElm.requestFullscreen()
}
//FireFox
if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen()
}
//Chrome等
if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen()
}
//IE11
if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen()
}
}
// 取消全屏
const cancelFullScreen = () => {
//W3C
if (document.exitFullscreen) {
document.exitFullscreen()
}
//FireFox
if (document.mozCancelFullScreen) {
document.mozCancelFullScreen()
}
//Chrome等
if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen()
}
//IE11
if (document.msExitFullscreen) {
document.msExitFullscreen()
}
}