Created
July 18, 2011 06:39
-
-
Save apoleshchuk/1088696 to your computer and use it in GitHub Desktop.
Safari 5.1 fullscreen demo
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Fullscreen demo</title> | |
<style> | |
body { | |
font-family: 'Myriad Pro', Arial; | |
} | |
p { | |
margin: 0; | |
} | |
#fullscreen__control { | |
display: inline-block; | |
margin: 20px auto 0; | |
text-align: center; | |
} | |
#fullscreen__element { | |
width: 50%; | |
margin: 10% auto; | |
background: rgba(0,0,0, .05); | |
padding: 2em; | |
} | |
body:-webkit-full-screen-document { | |
background: #ccc; | |
} | |
#fullscreen__element:-webkit-full-screen-document { | |
color: #fff; | |
background: #ccc; | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
box-sizing: border-box; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="fullscreen__element"> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
<button id="fullscreen__control">полноэкранный режим</button> | |
</div> | |
<script> | |
var fullscreen__control = document.getElementById('fullscreen__control'), | |
fullscreen__element = document.getElementById('fullscreen__element'); | |
fullscreen__control.addEventListener('click', function(event) { | |
if (document.webkitCurrentFullScreenElement == fullscreen__element) { | |
document.webkitCancelFullScreen(); | |
fullscreen__control.innerHTML = 'полноэкранный режим'; | |
} else { | |
fullscreen__element.webkitRequestFullScreen(); | |
fullscreen__control.innerHTML = 'обычный режим'; | |
} | |
}, false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment