Full screen mode toggle trigger
-
Hi All,
I need a control button to trigger full screen mode (equivalent to function key f11) and eventually to toggle it back (equivalent to pressing Esc in fullscreen mode). I could not find any widget or plugin to do this. I guess that this can be accomplished through js or php but I don’t know how.
Cheers,
Dario
Viewing 1 replies (of 1 total)
-
Used this script in page header
<script language=”JavaScript”>
// mozfullscreenerror event handler
function errorHandler() {
alert(‘mozfullscreenerror’);
}
document.documentElement.addEventListener(‘mozfullscreenerror’, errorHandler, false);// toggle full screen function toggleFullScreen() { if (!document.fullscreenElement && // alternative standard method !document.mozFullScreenElement && !document.webkitFullscreenElement) { // current working methods if (document.documentElement.requestFullscreen) { document.documentElement.requestFullscreen(); } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); } else if (document.documentElement.webkitRequestFullscreen) { document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } } else { if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } } } // keydown event handler document.addEventListener('keydown', function(e) { if (e.keyCode == 0 ) { // F11 key toggleFullScreen(); } }, false); // End --> </script>To insert the script I used Header and Footer Scripts plugin.
Topic resolved.
Viewing 1 replies (of 1 total)
The topic ‘Full screen mode toggle trigger’ is closed to new replies.
