Skip to content

Commit f1266f7

Browse files
committed
Added FullScreen Mode for Snake Game
1 parent 934d220 commit f1266f7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ <h4>Theme
2424
</h4>
2525
<div id="mode-wrapper" style="display: inline; width: auto;">
2626
<h2>Select which mode you would like to play in.</h2>
27+
<button onclick="go_full_screen()">Full Screen</button><br />
2728
<button id="Easy">Easy</button><br />
2829
<button id="Medium">Medium</button><br />
2930
<button id="Difficult">Difficult</button>
@@ -73,8 +74,21 @@ <h2>Select which mode you would like to play in.</h2>
7374
var mySnakeBoard = new SNAKE.Board( {
7475
boardContainer: "game-area",
7576
fullScreen: true
76-
});
77-
77+
});
7878
</script>
79+
<script type="text/javascript">
80+
function go_full_screen(){
81+
var elem = document.documentElement;
82+
if (elem.requestFullscreen) {
83+
elem.requestFullscreen();
84+
} else if (elem.msRequestFullscreen) {
85+
elem.msRequestFullscreen();
86+
} else if (elem.mozRequestFullScreen) {
87+
elem.mozRequestFullScreen();
88+
} else if (elem.webkitRequestFullscreen) {
89+
elem.webkitRequestFullscreen();
90+
}
91+
}
92+
</script>
7993
</body>
8094
</html>

0 commit comments

Comments
 (0)