Skip to content

Instantly share code, notes, and snippets.

@sefeng211
Created May 8, 2020 21:55
Show Gist options
  • Select an option

  • Save sefeng211/b3359e2c21c4e4c74e3f7cdaed90164b to your computer and use it in GitHub Desktop.

Select an option

Save sefeng211/b3359e2c21c4e4c74e3f7cdaed90164b to your computer and use it in GitHub Desktop.

Revisions

  1. sefeng211 created this gist May 8, 2020.
    42 changes: 42 additions & 0 deletions testcase-fullscreen.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    <!DOCTYPE html>
    <html>

    <head>
    <style>
    body {
    height: 10000px;
    margin: 0;
    }

    div {
    position: absolute;
    border: 2px solid red;
    top: 200px;
    width: 100vw;
    background-color: white;
    }

    </style>
    </head>

    <body>
    <div>
    <p> this is a dialog</p>
    </div>

    </body>
    <script>
    const div = document.querySelector("div")
    div.addEventListener("click", () => {
    div.requestFullscreen();
    });
    div.addEventListener("fullscreenchange", () => {
    if (document.fullscreenElement) {
    console.log("div fullscreen");
    } else {
    console.log("unfullscreen");
    }
    console.log(div.offsetParent);
    });
    </script>
    </html>