Skip to content

Instantly share code, notes, and snippets.

@yhancik
Created April 21, 2017 22:16
Show Gist options
  • Save yhancik/ca9458ab339a6bfe368f90d4c509df0a to your computer and use it in GitHub Desktop.
Save yhancik/ca9458ab339a6bfe368f90d4c509df0a to your computer and use it in GitHub Desktop.
<script>
// fullscreen stuff
var fullscreenButton = document.getElementById("fullscreen-button");
var fullscreenDiv    = document.getElementById("crtCanvas");
var fullscreenFunc   = fullscreenDiv.requestFullscreen;
if (!fullscreenFunc) {
  ['mozRequestFullScreen',
   'msRequestFullscreen',
   'webkitRequestFullScreen'].forEach(function (req) {
     fullscreenFunc = fullscreenFunc || fullscreenDiv[req];
   });
}
function enterFullscreen() {
  fullscreenFunc.call(fullscreenDiv);
}
fullscreenButton.addEventListener('click', enterFullscreen);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment