I don’t know why this doesn’t work.
Does anyone else know?
I am trying to make a page element full screen.
To start off with, I just hooked the custom function onto wp_head(); so it will show up on the front end;
The div element id is “main” (so ex header and menus).
Here is a shortened version:
<?php
add_action('wp_head', 'full_screen');
function full_screen() {
?>
<script type="text/javascript">
var elem = document.getElementById("main");
function openFullscreen() {
if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
}
</script>
I am still busy getting it to do things the way I want them done, but the preliminary try works if I replace my JavaScript script with the following from the Mozilla site quoted by Joy.
So far it only lets me make the entire document full screen when pressing Enter, but I’ll be able to work at making it only the body element and upon load, instead of upon Enter.