Skip to content

Instantly share code, notes, and snippets.

@jedahan
Created April 29, 2014 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedahan/11406679 to your computer and use it in GitHub Desktop.
Save jedahan/11406679 to your computer and use it in GitHub Desktop.
3ds centric html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=400">
<style>
body{margin:0px;}
#topscreen{width:400px;height:220px;overflow:hidden;}
#bottomscreen{width:320px;height:212px;overflow:hidden;margin:0 auto;}
</style>
<script type="text/javascript">
window.setInterval(function () {
window.scrollTo(40, 220);
}, 50);
document.onkeydown = keydetect;
function keydetect(e) {
if (e) {
var whichone = (e.which);
}
if (!e) {
e = event
var whichone = (e.keyCode);
}
if (whichone == 13) {
alert("You pressed the A button!");
$('.console').text('A BUTTON, BABY');
}
if (whichone == 37) {
alert("You pressed left on the D-pad!");
}
if (whichone == 38) {
alert("You pressed up on the D-pad!!");
}
if (whichone == 39) {
alert("You pressed right on the D-pad!");
}
if (whichone == 40) {
alert("You pressed down on the D-pad!");
}
}
</script>
</head>
<body>
<div id="topscreen">Top Screen</div>
<div id="bottomscreen">Bottom Screen</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment