Skip to content

Instantly share code, notes, and snippets.

@leandro
Forked from fnando/fullscreen.js
Created May 4, 2012 10:59
Show Gist options
  • Save leandro/2594130 to your computer and use it in GitHub Desktop.
Save leandro/2594130 to your computer and use it in GitHub Desktop.
Working with fullscreen
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