捕获Chrome浏览器全屏退出事件
document.addEventListener("fullscreenchange", function(e) { console.log("fullscreenchange", e); }); document.addEventListener("mozfullscreenchange", function(e) { console.log("mozfullscreenchange ", e); }); document.addEventListener("webkitfullscreenchange", function(e) { console.log("webkitfullscreenchange", e); }); document.addEventListener("msfullscreenchange", function(e) { console.log("msfullscreenchange", e); });
解决方法:
document.addEventListener("webkitfullscreenchange", function (e) { if (e.currentTarget.webkitIsFullScreen) { //注意:这里的frames[id],id是拓扑图监控的菜单id,如果菜单id变了,这里也要相应的变化 $("#fullscreen1", window.frames['name'].document).hide(); $("#quitfullscreen", window.frames['name'].document).show(); } else { $("#fullscreen1", window.frames['name'].document).show(); $("#quitfullscreen", window.frames['name'].document).hide(); } }, false);