美文网首页
全屏, 和退出全屏

全屏, 和退出全屏

作者: 小马哒哒哒哒哒哒 | 来源:发表于2020-01-10 10:59 被阅读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();
      }
    }
  }

相关文章

网友评论

      本文标题:全屏, 和退出全屏

      本文链接:https://www.haomeiwen.com/subject/atepactx.html