Created
July 18, 2011 22:13
-
-
Save gregersrygg/1090825 to your computer and use it in GitHub Desktop.
Scroll away addressbar for fullscreen webapps
This file contains hidden or 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> | |
<head> | |
<meta charset=utf-8 /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> | |
<title>JS Bin</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style> | |
article, aside, figure, footer, header, hgroup, | |
menu, nav, section { display: block; } | |
html, body { margin: 0px; height: 100%; } | |
body { | |
background-color: green; | |
border: 1px solid red; | |
} | |
</style> | |
<script> | |
addEventListener("load", function() { | |
var el = document.createElement("div"); | |
el.style.width = "1px"; | |
el.style.height = screen.height + "px"; | |
el.style.visibility = "hidden"; | |
document.body.appendChild(el); | |
setTimeout(function() { | |
window.scrollTo(0, 1); | |
document.body.style.height = window.innerHeight-2 + "px"; | |
document.body.removeChild(el); | |
}, 100); | |
}, false); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment