Created
December 13, 2016 09:36
-
-
Save kickbase/f70ab89b29132631fecc076b029c5871 to your computer and use it in GitHub Desktop.
[HTML] Toggle between full screen mode and windows mode for secondary display
This file contains 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> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Hide secondary display</title> | |
<meta charset="utf-8"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style type="text/css"> | |
body{ | |
background-color:black; | |
color:#333333; | |
} | |
</style> | |
</head> | |
<body id="content"> | |
<p >Hit enter key toggle between full screen mode and windows mode</p> | |
<script> | |
var element = document.getElementById("content"); | |
function toggleFullScreen() { | |
if(document.webkitIsFullScreen){ | |
document.webkitCancelFullScreen(); | |
}else{ | |
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); | |
} | |
} | |
document.addEventListener("keydown", function(e) { | |
if (e.keyCode == 13) { | |
toggleFullScreen(); | |
} | |
}, false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment