1 //判断是否全屏 2 const checkFull=()=> { 3 var isFull = 4 document.fullscreenElement || 5 document.mozFullScreenElement || 6 document.webkitFullscreenElement;//兼容不同浏览器 7 //to fix : false || undefined == undefined 8 if (isFull === undefined) isFull = false; 9 return isFull; 10 } 11 //监听窗口退出全屏解决无法监听Esc按键 12 window.onresize = function () { 13 if (!checkFull()) { 14 //要执行的动作 15 isFull.value = false;//样式改变 16 console.log("退出全屏") 17 } 18 }转载地址:https://blog.csdn.net/xiaoyanli8077/article/details/89537911 标签:false,undefined,isFull,esc,全屏,document,监听 From: https://www.cnblogs.com/lisir-blogshare/p/16943413.html