捕獲Chrome瀏覽器全屏退出事件

參考地址web

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);
});

解決方法:segmentfault

 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);
相關文章
相關標籤/搜索