Created
January 7, 2015 20:57
-
-
Save szolotykh/d38352274642f6555985 to your computer and use it in GitHub Desktop.
Web page (div) fullscreen mode
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
<html> | |
<head> | |
<script> | |
function goFullScreen(elem){ | |
if (elem.requestFullscreen) { | |
elem.requestFullscreen(); | |
} else if (elem.msRequestFullscreen) { | |
elem.msRequestFullscreen(); | |
} else if (elem.mozRequestFullScreen) { | |
elem.mozRequestFullScreen(); | |
} else if (elem.webkitRequestFullscreen) { | |
elem.webkitRequestFullscreen(); | |
} | |
} | |
function init(){ | |
console.log("init"); | |
// goFullScreen not works here | |
} | |
</script> | |
</head> | |
<body onload="init();"> | |
<div id = "container"> | |
Full screen | |
</div> | |
<input type="button" value = "goFullScreen" onclick="goFullScreen(document.getElementById('container'));" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment