Skip to content

Instantly share code, notes, and snippets.

@samccone
Created January 21, 2012 20:56
Show Gist options
  • Save samccone/1653975 to your computer and use it in GitHub Desktop.
Save samccone/1653975 to your computer and use it in GitHub Desktop.
HTML5 Enter Full Screen Shim
// detecting if browser supports fullscreen
return document.body.mozRequestFullScreen || document.body.webkitRequestFullScreen || document.body.requestFullScreen;
// requesting full screen on an elm
( elm.mozRequestFullScreen && elm.mozRequestFullScreen() ) || ( elm.webkitRequestFullScreen && elm.webkitRequestFullScreen() ) || ( elm.requestFullScreen && elm.requestFullScreen() );
//binding to full screen event
( document.body.requestFullScreen && window.addEventListener('fullscreenchange',fullScreenEvent) ) || ( document.body.webkitRequestFullScreen && window.addEventListener('webkitfullscreenchange',fullScreenEvent ) ) || ( document.body.mozRequestFullScreen && window.addEventListener('mozfullscreenchange',fullScreenEvent) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment