Ocultar botón de pantalla completa si no es posible

This commit is contained in:
Nulo 2021-07-06 22:13:18 +00:00
parent fbcb0f59e9
commit d2105b0ea4

View file

@ -295,12 +295,17 @@ async function initJuego() {
window.requestAnimationFrame(loop);
}
document.getElementById("full-screen")!.addEventListener("click", async () => {
const fullscreenEl = document.getElementById("full-screen")!;
if ("requestFullscreen" in document.documentElement) {
fullscreenEl.addEventListener("click", async () => {
document.documentElement.requestFullscreen &&
(await document.documentElement.requestFullscreen({
navigationUI: "hide",
}));
await screen.orientation.lock("landscape");
});
} else {
fullscreenEl.hidden = true;
}
initJuego();