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

      

  • 相关阅读:
    7A
    map最最最基本用法
    cccc超级酱油心得
    scu-4445
    初学算法之广搜
    初学算法之最基础的stl队列
    初学算法之筛选素数法
    go 虎牙爬取
    php使用xpath爬取内容
    go xpath
  • 原文地址:https://www.cnblogs.com/cx709452428/p/13358009.html
Copyright © 2011-2022 走看看