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);
};
that.enter = function() {
if (document.body.requestFullscreen) {
document.body.requestFullscreen();
} else if (document.body.mozRequestFullScreen) {
document.body.mozRequestFullScreen();
} else if (document.body.webkitRequestFullscreen) {
document.body.webkitRequestFullscreen();
that.enter = function(element) {
var element = element || document.body;
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
}
// FIXME: Why does storing the function in a variable not work?
// enter && enter();