Created
December 17, 2015 10:16
-
-
Save Ch00k/bc44aa9a824a153b5e64 to your computer and use it in GitHub Desktop.
App
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
<html> | |
<head> | |
<style> | |
html, body { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
div { | |
width: 16px; | |
height: 16px; | |
float: left; | |
} | |
.white { | |
background: #ffffff; | |
} | |
.black { | |
background: #000000; | |
} | |
</style> | |
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script> | |
<script type="text/javascript"> | |
$(document).keydown(function(e){ | |
console.log(e.which) | |
switch(e.which) { | |
case 37: // left | |
$('#screen').removeClass('white').addClass('black'); | |
break; | |
case 39: // right | |
$('#screen').removeClass('black').addClass('white'); | |
break; | |
default: return; // exit this handler for other keys | |
} | |
e.preventDefault(); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="screen" class="white"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment