进入全屏 1 if (document.documentElement.requestFullscreen) { 2 // W3C 3 docElm.requestFullscreen() 4 } else if (docElm.mozRequestFullScreen) { 5 // FireFox 6 docElm.mozRequestFullScreen() 7 } else if (docElm.webkitRequestFullScreen) { 8 // Chrome等 9 docElm.webkitRequestFullScreen() 10 } else if (docElm.msRequestFullscreen) { 11 // IE11 12 docElm.msRequestFullscreen() 13 }退出全屏 14 if (document.exitFullscreen) { 15 document.exitFullscreen() 16 } else if (document.mozCancelFullScreen) { 17 document.mozCancelFullScreen() 18 } else if (document.webkitCancelFullScreen) { 19 document.webkitCancelFullScreen() 20 } else if (document.msExitFullscreen) { 21 document.msExitFullscreen() 22 }
原文地址:https://www.cnblogs.com/W-it-H-ou-T/p/10999375.html
时间: 2024-10-13 08:08:01