D
Dennis van Duin
Guest
Hi people,
Is it possible to make an button to switch between normal screen and HTML5 fullscreen. Like I did it with this code in PhP:
But I want to make an button inside my game... So i dont need to make an button with html...
Can someone help me?
Greets,
Dennis
Is it possible to make an button to switch between normal screen and HTML5 fullscreen. Like I did it with this code in PhP:
<!DOCTYPE html>
<html>
<body>
<input class="button" type="button" value="Fullscreen" onclick="toggleFullScreen()" style="position: absolute; bottom: 0; right: 0; float: right; clear:right;">
<script>
function toggleFullScreen() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
}
</script>
</body>
</html>
<html>
<body>
<input class="button" type="button" value="Fullscreen" onclick="toggleFullScreen()" style="position: absolute; bottom: 0; right: 0; float: right; clear:right;">
<script>
function toggleFullScreen() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
}
</script>
</body>
</html>
But I want to make an button inside my game... So i dont need to make an button with html...
Can someone help me?
Greets,
Dennis