Created
May 8, 2020 21:55
-
-
Save sefeng211/b3359e2c21c4e4c74e3f7cdaed90164b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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