Skip to content
This repository was archived by the owner on Oct 9, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions demos.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[
{
"desc": "Full screen of the page, and individual elements",
"url": "fullscreen",
"tags": "fullscreen",
"support": {
"live": "opera chrome firefox safari",
"nightly": ""
},
"test": "document.body.requestFullscreen !== undefined"
},
{
"desc": "Stream video and filter with canvas",
"url": "gum-canvas",
Expand Down
58 changes: 58 additions & 0 deletions demos/fullscreen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<title>Simple Fullscreen API demo</title>
<style>
#status {
background: #c00;
}

#game {

}
</style>
<article>
<p>This example shows how an element can request fullscreen support from the browser.</p>
<p id="unavailable">Not supported :(</p>
<div id="game">
<button id="gofull">Go fullscreen</button>
<button id="goback">Go back to non-fullscreen</button>
</div>
</article>
<script>
function $(id) {
return document.getElementById(id);
}

// fullscreen is a bit of mess due to mixed case support
// taken from http://voxeljs.com/ the very cool game world
// building toolkit by @maxogden, et al
function shim(el) {
return (el.requestFullscreen ||
el.webkitRequestFullscreen ||
el.webkitRequestFullScreen ||
el.mozRequestFullscreen ||
el.mozRequestFullScreen ||
el.msRequestFullscreen ||
el.msRequestFullScreen ||
el.oRequestFullscreen ||
el.oRequestFullScreen)
}

function available() {
return !!shim(document.body)
}

var no = $('unavailable'),
go = $('gofull'),
back = $('goback');

if (available()) {
no.parentNode.removeChild(no);
}

go.onclick = function () {
shim(this.parentNode).call(this.parentNode);
}




</script>