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();
            }
          }
        }
    

      

  • 相关阅读:
    求菲波那契数列的第n个数
    一个球,初始高度100,每次落下回弹一半高度,求第n次落下球走的距离
    MySQL优化
    linux常用命令2
    win7安装ANT
    win7配置java环境变量
    kvm虚拟机磁盘文件读取小结
    kvm linux虚拟机在线扩展磁盘
    binlog2sql
    linux上 查看mysql的binglog日志
  • 原文地址:https://www.cnblogs.com/cx709452428/p/13358009.html
Copyright © 2011-2022 走看看