Skip to content

Instantly share code, notes, and snippets.

@wilburhimself
Created November 14, 2012 22:15
Show Gist options
  • Select an option

  • Save wilburhimself/4075247 to your computer and use it in GitHub Desktop.

Select an option

Save wilburhimself/4075247 to your computer and use it in GitHub Desktop.
HTML5 Fullscreen API
<!DOCTYPE html>
<html>
<head>
<title>FullScreen API</title>
<meta charset="utf-8" />
</head>
<body>
<h3>Click en las opciones para activar/desactivar el modo FullScreen</h3>
<button id="enable" onclick="enableFullScreen(document.documentElement);">FullScreen</button>​
<button onclick="cancelFullScreen();">Cancelar Fullscreen</button>
<script>
function enableFullScreen(element) {
if (element.requestFullScreen) {
element.requestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
function cancelFullScreen() {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment