zoukankan      html  css  js  c++  java
  • 浏览器全屏效果

    1.全屏监听事件
    const isFullscreen =
          document.fullscreenElement ||
          document.mozFullScreenElement ||
          document.webkitFullscreenElement ||
          document.fullScreen ||
          document.mozFullScreen ||
          document.webkitIsFullScreen;
        isFullscreen = !!isFullscreen;
        let that = this;
        document.addEventListener("fullscreenchange", () => {
          that.isFull = !that.isFull;
        });
        document.addEventListener("mozfullscreenchange", () => {
          that.isFull = !that.isFull;
        });
        document.addEventListener("webkitfullscreenchange", () => {
          that.isFull = !that.isFull;
        });
        document.addEventListener("msfullscreenchange", () => {
          that.isFull = !that.isFull;
        });
    
    2.全屏点击事件
    fullScreenEvent() {
          let el = document.documentElement;
          if (this.isFull) {
            if (document.exitFullscreen) {
              document.exitFullscreen();
            } else if (document.mozCancelFullScreen) {
              document.mozCancelFullScreen();
            } else if (document.webkitCancelFullScreen) {
              document.webkitCancelFullScreen();
            } else if (document.msExitFullscreen) {
              document.msExitFullscreen();
            }
          } else {
            if (el.requestFullscreen) {
              el.requestFullscreen();
            } else if (el.mozRequestFullScreen) {
              el.mozRequestFullScreen();
            } else if (el.webkitRequestFullScreen) {
              el.webkitRequestFullScreen();
            } else if (el.msRequestFullscreen) {
              el.msRequestFullscreen();
            }
          }
        }
    

      

  • 相关阅读:
    Jzoj4782 Math
    Jzoj4778 数列编辑器
    Jzoj4778 数列编辑器
    力扣算法题—067二进制求和
    力扣算法题—066加一
    最小凸包算法
    力扣算法题—065有效数字
    力扣算法题—064最小路径之和
    力扣算法题—063不同路径2
    力扣算法题—062不同路径
  • 原文地址:https://www.cnblogs.com/cx709452428/p/13358009.html
Copyright © 2011-2022 走看看