Apply fullscreen to document.documentElement instead of getting the body
This commit is contained in:
parent
7e0a91d839
commit
82162c3c5e
1 changed files with 9 additions and 9 deletions
|
@ -1,13 +1,13 @@
|
|||
function enterFullScreen() {
|
||||
const body = document.getElementsByTagName('body')[0];
|
||||
if (body.requestFullscreen()) {
|
||||
return body.requestFullscreen();
|
||||
} else if (body.msRequestFullscreen()) {
|
||||
return body.msRequestFullscreen();
|
||||
} else if (body.mozRequestFullScreen()) {
|
||||
return body.mozRequestFullScreen();
|
||||
} else if (body.webkitRequestFullscreen()) {
|
||||
return body.webkitRequestFullscreen();
|
||||
const app = document.documentElement;
|
||||
if (app.requestFullscreen()) {
|
||||
return app.requestFullscreen();
|
||||
} else if (app.msRequestFullscreen()) {
|
||||
return app.msRequestFullscreen();
|
||||
} else if (app.mozRequestFullScreen()) {
|
||||
return app.mozRequestFullScreen();
|
||||
} else if (app.webkitRequestFullscreen()) {
|
||||
return app.webkitRequestFullscreen();
|
||||
} else {
|
||||
console.warn('This browser does not support fullscreen mode');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue