So I'm making a game, and after much consideration I've decided I want to make it fullscreen. I am using Chrome and have tried $("container").webkitRequestFullScreen();
, but it's not working, even when I copy the files to my localhost server.
Is there something I'm missing? Is my code wrong? Here it is:
var cont = $("container");
if (cont.requestFullscreen) {
cont.requestFullscreen();
}
if (cont.webkitRequestFullscreen) {
cont.webkitRequestFullscreen();
}
if (cont.mozRequestFullscreen) {
cont.mozRequestFullscreen();
}
if (cont.msRequestFullscreen) {
cont.msRequestFullscreen();
}
So that's my code. cont
is a reference to my container div.
Thanks in advance!
EDIT: I keep forgetting to mention this - my $
function is not jQuery, it's just returning document.getElementById(id);
.
EDIT 2: And despite what StackOverflow says, I am not using IE! I am not even looking for IE support!