Last active
August 29, 2015 14:06
-
-
Save michaelwhyte/026821f24072edddd83c to your computer and use it in GitHub Desktop.
Code for exiting fullscreen mode using the HTML5 fullscreen API
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
var btn02 = document.getElementById('btn-02'); | |
// Exit full-screen mode when btn02 | |
// is clicked | |
btn02.addEventListener('click', function(){ | |
exitFullscreen(); | |
}, false); | |
// Helper function for dealing | |
// with the various ways that | |
// different browsers handle | |
// exiting full-screen mode | |
function exitFullscreen() { | |
if(document.exitFullscreen) { | |
document.exitFullscreen(); | |
} 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