Ox.Fullscreen: allow passing an element to enter method, document.body remains default

This commit is contained in:
rolux 2014-05-12 02:45:50 +02:00
parent b18c84a4ce
commit 56468a9208

View file

@ -98,13 +98,14 @@ Ox.Fullscreen = (function() {
bind(event, handler, true); bind(event, handler, true);
}; };
that.enter = function() { that.enter = function(element) {
if (document.body.requestFullscreen) { var element = element || document.body;
document.body.requestFullscreen(); if (element.requestFullscreen) {
} else if (document.body.mozRequestFullScreen) { element.requestFullscreen();
document.body.mozRequestFullScreen(); } else if (element.mozRequestFullScreen) {
} else if (document.body.webkitRequestFullscreen) { element.mozRequestFullScreen();
document.body.webkitRequestFullscreen(); } else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} }
// FIXME: Why does storing the function in a variable not work? // FIXME: Why does storing the function in a variable not work?
// enter && enter(); // enter && enter();