Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
jcponce committed Aug 13, 2024
1 parent 7390d61 commit f6d8ec9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion threejs/string-space/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.min.js",
"jsm/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/"
}
}
Expand All @@ -66,6 +66,26 @@
<p>❤️ <a href="https://www.patreon.com/jcponce">Patreon</a></p>
</div>
<script type="module" src="index.js"></script>

<script>
// Function to toggle full screen mode
function toggleFullScreen() {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen().catch(err => {
console.error(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`);
});
} else {
document.exitFullscreen();
}
}

// Event listener for keydown event
document.addEventListener('keydown', (event) => {
if (event.key === 'f' || event.key === 'F') {
toggleFullScreen();
}
});
</script>
</body>

</html>

0 comments on commit f6d8ec9

Please sign in to comment.