-
-
Save mackhowell/6d2ac94d29767052e3c6 to your computer and use it in GitHub Desktop.
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> | |
<head> | |
<script src="http://code.jquery.com/jquery-git2.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
$(document.activeElement).on('keydown', function(e) { | |
switch (e.which) { | |
// key code for left arrow | |
case 37: | |
console.log('left arrow key pressed!'); | |
break; | |
// key code for right arrow | |
case 39: | |
console.log('right arrow key pressed!'); | |
break; | |
} | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-git2.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript">$(document.activeElement).on('keydown', function(e) { | |
switch (e.which) { | |
// key code for left arrow | |
case 37: | |
console.log('left arrow key pressed!'); | |
break; | |
// key code for right arrow | |
case 39: | |
console.log('right arrow key pressed!'); | |
break; | |
} | |
});</script></body> | |
</html> |
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
$(document.activeElement).on('keydown', function(e) { | |
switch (e.which) { | |
// key code for left arrow | |
case 37: | |
console.log('left arrow key pressed!'); | |
break; | |
// key code for right arrow | |
case 39: | |
console.log('right arrow key pressed!'); | |
break; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment