Created
May 1, 2012 21:35
-
-
Save fnando/2571613 to your computer and use it in GitHub Desktop.
Working with fullscreen
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
var body = document.body; | |
if (body.requestFullScreen) { | |
body.requestFullScreen(); | |
} else if (body.mozRequestFullScreen) { | |
body.mozRequestFullScreen(); | |
} else if (body.webkitRequestFullScreen) { | |
body.webkitRequestFullScreen(); | |
} | |
if (document.cancelFullScreen) { | |
document.cancelFullScreen(); | |
} else if (document.mozCancelFullScreen) { | |
document.mozCancelFullScreen(); | |
} else if (document.webkitCancelFullScreen) { | |
document.webkitCancelFullScreen(); | |
} | |
$(document).on("fullscreenchange", callback); | |
$(document).on("webkitfullscreenchange", callback); | |
$(document).on("mozfullscreenchange", callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment