全屏, 和退出全屏

2020-01-10  本文已影响0人  小马哒哒哒哒哒哒
// 全屏
  fullScreen(that) {
    that.isfullScreen = !that.isfullScreen;
    let element = document.documentElement;
    if (that.isfullScreen) {
      if (element.requestFullscreen) {
          element.requestFullscreen();
      } else if (element.webkitRequestFullScreen) {
          element.webkitRequestFullScreen();
      } else if (element.mozRequestFullScreen) {
          element.mozRequestFullScreen();
      } else if (element.msRequestFullscreen) {
          // IE11
          element.msRequestFullscreen();
      }
    } else {
      if (document.exitFullscreen) {
          document.exitFullscreen();
      } else if (document.webkitCancelFullScreen) {
          document.webkitCancelFullScreen();
      } else if (document.mozCancelFullScreen) {
          document.mozCancelFullScreen();
      } else if (document.msExitFullscreen) {
          document.msExitFullscreen();
      }
    }
  }
上一篇下一篇

猜你喜欢

热点阅读