Skip to content

Instantly share code, notes, and snippets.

@robshep
Last active June 29, 2019 07:08
Show Gist options
  • Select an option

  • Save robshep/65340c7d91a392283ea0010e3c7cb41d to your computer and use it in GitHub Desktop.

Select an option

Save robshep/65340c7d91a392283ea0010e3c7cb41d to your computer and use it in GitHub Desktop.
<html>
<body>
<h1 id="h">Hi 3</h1>
<script src="https://code.jquery.com/jquery-3.4.1.slim.js"></script>
<script>
function enterFullscreen() {
var element = document.documentElement;
// Check which implementation is available
var requestMethod = element.requestFullscreen ||
element.webkitRequestFullscreen ||
element.webkitRequestFullScreen ||
element.mozRequestFullScreen ||
element.msRequestFullscreen;
if (requestMethod) {
requestMethod.apply(element);
}
}
$("#h").on("click touchstart", function(){ enterFullscreen() });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment