Skip to content

Commit 9a58344

Browse files
committed
initial commit simple fullscreen demo
1 parent 0e4aff9 commit 9a58344

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

demos.json

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
[
2+
{
3+
"desc": "Full screen of the page, and individual elements",
4+
"url": "fullscreen",
5+
"tags": "fullscreen",
6+
"support": {
7+
"live": "opera",
8+
"nightly": "chrome firefox safari"
9+
},
10+
"test": ""
11+
},
212
{
313
"desc": "Stream video and filter with canvas",
414
"url": "gum-canvas",

demos/fullscreen.html

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<title>Simple Fullscreen API demo</title>
2+
<style>
3+
#status {
4+
background: #c00;
5+
}
6+
7+
#game {
8+
9+
}
10+
</style>
11+
<article>
12+
<p>This example shows how an element can request fullscreen support from the browser.</p>
13+
<p id="unavailable">Not supported :(</p>
14+
<div id="game">
15+
16+
</div>
17+
</article>
18+
<script>
19+
function $(id) {
20+
return document.getElementById(id);
21+
}
22+
23+
// fullscreen is a bit of mess due to mixed case support
24+
// taken from http://voxeljs.com/ the very cool game world
25+
// building toolkit by @maxogden, et al
26+
function shim(el) {
27+
return (el.requestFullscreen ||
28+
el.webkitRequestFullscreen ||
29+
el.webkitRequestFullScreen ||
30+
el.mozRequestFullscreen ||
31+
el.mozRequestFullScreen ||
32+
el.msRequestFullscreen ||
33+
el.msRequestFullScreen ||
34+
el.oRequestFullscreen ||
35+
el.oRequestFullScreen)
36+
}
37+
38+
function available() {
39+
return !!shim(document.body)
40+
}
41+
42+
var no = $('#unavailable');
43+
44+
if (available()) {
45+
no.parentNode.removeChild(no);
46+
}
47+
48+
49+
50+
51+
</script>

0 commit comments

Comments
 (0)