我有一个页面,用于检查用户是否离开了全屏。我想删除/销毁此事件观察者,但无法找到我如何在描述上执行此操作 API Description 这是我的代码:
//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!
?????????
}
};
答案 0 :(得分:1)
您打算删除活动的目的是什么?
document.onwebkitfullscreenchange = null;
应该有用。