Skip to content

Instantly share code, notes, and snippets.

@christianboyle
Last active July 18, 2023 02:54
Show Gist options
  • Save christianboyle/226e4cfd9431a0c46bdce6c34bb8ffba to your computer and use it in GitHub Desktop.
Save christianboyle/226e4cfd9431a0c46bdce6c34bb8ffba to your computer and use it in GitHub Desktop.
eo1 workaround
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="height=1920; width=1080;">
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #000;
}
img {
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
object-fit: none;
}
</style>
<body>
<img class="canfullscreen" src="https://path/to/your/art.png">
<script>
function getreqfullscreen() {
var root = document.documentElement
return root.requestFullscreen || root.webkitRequestFullscreen || root.mozRequestFullScreen || root.msRequestFullscreen
}
function getexitfullscreen() {
return document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen
}
function getfullscreenelement() {
return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement
}
var globalreqfullscreen = getreqfullscreen()
var globalexitfullscreen = getexitfullscreen()
document.addEventListener('click', function (e) {
var target = e.target
if (target.tagName == "IMG" && target.classList.contains('canfullscreen')) {
if (getfullscreenelement() == null) {
globalreqfullscreen.call(target)
}
else {
globalexitfullscreen.call(document)
}
}
}, false)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment