• toFullScreen:全屏------exitFullscreen:退出全屏


    toFullScreen:全屏

    function toFullScreen(){    
      let elem = document.body;

      elem.webkitRequestFullScreen

      ? elem.webkitRequestFullScreen()

      : elem.mozRequestFullScreen

      ? elem.mozRequestFullScreen()

      : elem.msRequestFullscreen

      ? elem.msRequestFullscreen()

      : elem.requestFullScreen

      ? elem.requestFullScreen()

      : alert("浏览器不支持全屏");
    }

    exitFullscreen:退出全屏

    function exitFullscreen(){    
      let elem = parent.document;

      elem.webkitCancelFullScreen

      ? elem.webkitCancelFullScreen()

      : elem.mozCancelFullScreen

      ? elem.mozCancelFullScreen()

      : elem.cancelFullScreen

      ? elem.cancelFullScreen()

      : elem.msExitFullscreen

      ? elem.msExitFullscreen()

      : elem.exitFullscreen

      ? elem.exitFullscreen()

      : alert("切换失败,可尝试Esc退出");
    }
     
  • 相关阅读:
    JDK动态代理
    回顾反射机制Method
    静态代理和动态代理
    使用jQuery实现ajax请求
    ajax函数
    事件 on
    函数2
    pytest-mock 调试实例
    Linux自启动tomcat
    第一次做性能测试
  • 原文地址:https://www.cnblogs.com/EternalZH/p/12213900.html
Copyright © 2020-2023  润新知