HTML5 Fullscreen Button

D

DKrank

Guest
Does anyone know how I would go about programming a fullscreen button for my html game much like a YouTube or Vimeo video would have? I found javascript for it and I thought I could apply it as an extension, but that doesn't seem to work. It has to be possible, because somewhere in the code Gamemaker has full screen functionality for F10 keyboard presses.

The code I found was:

var videoElement = document.getElementById("canvas");

function toggleFullScreen() {
if (!document.mozFullScreen && !document.webkitFullScreen) {
if (videoElement.mozRequestFullScreen) {
videoElement.mozRequestFullScreen();
} else {
videoElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else {
document.webkitCancelFullScreen();
}
}
}
 

Mike

nobody important
GMC Elder
Look into "clickable_add()" Then from the callback set fullscreen.

HTML5 only allows you to go into fullscreen from a users "click" event, so they have to be done via the clickables API (or Javascript plugin)
 
Top