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 14, 2024
1 parent 5feb9da commit b822b40
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions threejs/dodecahedron-fractal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@
</script>

<script type="module" src="./script.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 b822b40

Please sign in to comment.