zoukankan      html  css  js  c++  java
  • javascript全屏操作

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <title>Document</title>
      <style type="text/css">
      html,
      body {
        padding: 0;
        margin: 0;
         100%;
        height: 100%;
        background: green;
      }
      </style>
    </head>
    
    <body>
      <button id="btn">button</button>
      <p id="">这是一个段落</p>
      <script type="text/javascript">
      var btn = document.querySelector('#btn');
      btn.addEventListener('click', function(e) {
        if (document.body.RequestFullscreen) {
          document.body.RequestFullscreen();
        } else if (document.body.webkitRequestFullscreen) {
          document.body.webkitRequestFullscreen();
        } else {
          console.log('不支持')
        }
        // e.preventDefault()
      })
      </script>
    </body>
    
    </html>
    

    点击按钮将会全屏,esc退出全屏

  • 相关阅读:
    Liunx cal
    Liunx read
    IOS
    IOS
    ARPSpoofing教程(四)
    ARPSpoofing教程(三)
    ARPSpoofing教程(二)
    数据结构与算法分析
    hdu 2034
    hdu 2042
  • 原文地址:https://www.cnblogs.com/yesyes/p/7264027.html
Copyright © 2011-2022 走看看