0

我有一个页面正在检查用户是否离开全屏。我想删除/销毁此事件观察器,但无法在描述 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!
          ?????????

        }
      };
4

1 回答 1

1

您删除该事件的意图是什么?

document.onwebkitfullscreenchange = null;

应该管用。

于 2017-09-27T14:08:12.423 回答