Skip to content

Instantly share code, notes, and snippets.

@thisislawatts
Created October 22, 2012 09:29
Show Gist options
  • Save thisislawatts/3930616 to your computer and use it in GitHub Desktop.
Save thisislawatts/3930616 to your computer and use it in GitHub Desktop.
iPhone rotatothon
<!DOCTYPE html>
<!--[if lt IE 7]> <html dir="ltr" lang="en-US" id="h" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html dir="ltr" lang="en-US" id="h" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html dir="ltr" lang="en-US" id="h" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html ldir="ltr" lang="en-US" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>iPhone Tilterising</title>
<style>
div {
position: absolute;
top: 50%;
margin-top: -.5em;
left: 0;
width: 100%;
text-align: center;
}
</style>
</head>
<body>
<div id="shout">
Easy Now!
</div>
<script>
var element = document.getElementById('shout'),
pleasantries = [
'Woah there!',
'Steady at the helm',
'Stop rocking the boat',
'Less caffeine for you'
]; // Better phrases!
window.addEventListener( "orientationchange", orient );
function orient(e) {
element.innerHTML = pleasantries[Math.floor(Math.random() * pleasantries.length)];
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment