Ox.Fullscreen: allow passing an element to enter method, document.body remains default
This commit is contained in:
parent
b18c84a4ce
commit
56468a9208
1 changed files with 8 additions and 7 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue