2017-05-16 23:37:17 +08:00
|
|
|
toggleFullScreen = () => {
|
2017-06-03 03:25:02 +08:00
|
|
|
const element = document.documentElement;
|
2017-05-16 23:37:17 +08:00
|
|
|
|
|
|
|
if (document.fullscreenElement
|
|
|
|
|| document.webkitFullscreenElement
|
|
|
|
|| document.mozFullScreenElement
|
|
|
|
|| document.msFullscreenElement) {
|
|
|
|
if (document.exitFullscreen) {
|
|
|
|
document.exitFullscreen();
|
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
} else if (document.webkitExitFullscreen) {
|
|
|
|
document.webkitExitFullscreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the page is not currently fullscreen, make fullscreen
|
2017-06-03 03:25:02 +08:00
|
|
|
} else if (element.requestFullscreen) {
|
|
|
|
element.requestFullscreen();
|
|
|
|
} else if (element.mozRequestFullScreen) {
|
|
|
|
element.mozRequestFullScreen();
|
|
|
|
} else if (element.webkitRequestFullscreen) {
|
|
|
|
element.webkitRequestFullscreen();
|
|
|
|
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
|
|
|
} else if (element.msRequestFullscreen) {
|
|
|
|
element.msRequestFullscreen();
|
2017-05-16 23:37:17 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export {
|
|
|
|
toggleFullScreen,
|
|
|
|
};
|