Skip to content

Instantly share code, notes, and snippets.

@sefeng211
Created May 8, 2020 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sefeng211/b3359e2c21c4e4c74e3f7cdaed90164b to your computer and use it in GitHub Desktop.
Save sefeng211/b3359e2c21c4e4c74e3f7cdaed90164b to your computer and use it in GitHub Desktop.
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment