let toggleFullscreen = (elem) => { elem = elem || document.documentElement; if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } } else { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } } }; let isInFullScreenMode = () => { if (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement) { return true; } return false; }; let addFullscreenOnClick = (element) => { element.addEventListener('click', () => { toggleFullscreen(element); }); };
153900cookie-checkHtml Fullscreen API