Last active
August 29, 2015 14:08
-
-
Save tristaaan/a344e845df7dd1f152cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toggleFullscreen(){ | |
if (!document.fullscreenElement && // alternative standard method | |
!document.mozFullScreenElement && | |
!document.webkitFullscreenElement && | |
!document.msFullscreenElement ) { // current working methods | |
if (document.documentElement.requestFullscreen) { | |
document.documentElement.requestFullscreen(); | |
} else if (document.documentElement.msRequestFullscreen) { | |
document.documentElement.msRequestFullscreen(); | |
} else if (document.documentElement.mozRequestFullScreen) { | |
document.documentElement.mozRequestFullScreen(); | |
} else if (document.documentElement.webkitRequestFullscreen) { | |
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); | |
} | |
} | |
else { | |
if (document.exitFullscreen) { | |
document.exitFullscreen(); | |
} else if (document.msExitFullscreen) { | |
document.msExitFullscreen(); | |
} else if (document.mozCancelFullScreen) { | |
document.mozCancelFullScreen(); | |
} else if (document.webkitExitFullscreen) { | |
document.webkitExitFullscreen(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment