From 3bceb5a859f633985349ccb430682ae471c770e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Jask=C3=B3lski?= Date: Fri, 23 Dec 2022 12:47:40 +0100 Subject: [PATCH] )) |'ve added a fullscreen option via double-click anywhere on the page. )) Now the feather info icon is fading out after 3s, and it appears every time the user hovers it with the mouse. )) I've changed a little bit formatting of the code --- fullscreen.js | 30 ++++++++++++++++++++++++++++++ index.html | 4 +++- modal.js | 19 ++++++++++++------- style.css | 12 ++++++++++++ 4 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 fullscreen.js diff --git a/fullscreen.js b/fullscreen.js new file mode 100644 index 0000000..ed87415 --- /dev/null +++ b/fullscreen.js @@ -0,0 +1,30 @@ +function toggleFullScreen() { + const doc = window.document; + const docEl = doc.documentElement; + + var requestFullScreen = + docEl.requestFullscreen || + docEl.mozRequestFullScreen || + docEl.webkitRequestFullScreen || + docEl.msRequestFullscreen; + var cancelFullScreen = + doc.exitFullscreen || + doc.mozCancelFullScreen || + doc.webkitExitFullscreen || + doc.msExitFullscreen; + + if ( + !doc.fullscreenElement && + !doc.mozFullScreenElement && + !doc.webkitFullscreenElement && + !doc.msFullscreenElement + ) { + requestFullScreen.call(docEl); + } else { + cancelFullScreen.call(doc); + } +} + +document.addEventListener("dblclick", () => { + toggleFullScreen(); +}); diff --git a/index.html b/index.html index 19a055d..7d22da3 100644 --- a/index.html +++ b/index.html @@ -41,6 +41,7 @@

Just a black web page

Created by Kevin Py for Pyxel.

Find the repository on Gitlab.

+

You can double-click anywhere on the page to cover your entire screen with black!

A 10 hours black screen video