0
我得到一個頁面,檢查用戶是否離開全屏。我想刪除/銷燬這個事件的觀察者,但無法找到我怎麼能在描述 API Description 這裏做,這是我的代碼:刪除document.onfullscreenchange全屏API
//create black background and disable scrolling
$rootScope.fullScreen = !$rootScope.fullScreen;
//make div fullScreen (Browser Native)
if($rootScope.fullScreen == true) {
var videoWindow = document.getElementById("full-screen");
if (videoWindow.requestFullscreen) {
videoWindow.requestFullscreen();
}
//check if user has closed fullscreen
document.onwebkitfullscreenchange = function (event) {
if(!document.webkitFullscreenElement) {
$rootScope.fullScreen = false;
//REMOVE THE EVENTHANDLER - STOP WATCHING!
?????????
}
};
我想在用戶關閉全屏窗口時將其刪除。沒有必要繼續觀看這個活動。它是一個更大的角度應用程序的一部分,所以我想保持清潔。您的簡單解決方案很有用!很簡單!謝謝! – elpeyotl