Created
November 7, 2012 00:03
-
-
Save benjaminfisher/4028562 to your computer and use it in GitHub Desktop.
Cross browser full screen API access
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
// Find the right method, call on correct element | |
function launchFullScreen(element) { | |
if(element.requestFullScreen) { | |
element.requestFullScreen(); | |
} else if(element.mozRequestFullScreen) { | |
element.mozRequestFullScreen(); | |
} else if(element.webkitRequestFullScreen) { | |
element.webkitRequestFullScreen(); | |
} | |
} | |
// Launch fullscreen for browsers that support it! | |
launchFullScreen(document.documentElement); // the whole page | |
launchFullScreen(document.getElementById("videoElement")); // any individual element |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment