Skip to content

Instantly share code, notes, and snippets.

@Kanol
Created October 30, 2015 16:05
Show Gist options
  • Save Kanol/bdfedff0b28d0aa1a2a7 to your computer and use it in GitHub Desktop.
Save Kanol/bdfedff0b28d0aa1a2a7 to your computer and use it in GitHub Desktop.
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><style>
.player {
position: absolute;
}
</style>
</head><body><div class="player" style="
top: 0;
left: 0;
">
<img src="./Man_files/Man.png" style="
height: 200px;
width: 200px
">
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
var x = 0;
var y = 0;
var $player = $('Iplayer');
$player.css('top', y);
$player.css('left', x);
function move(e) {
console.log(e);
if (e.charCode == 1094) {
y = y + 10;
$player.css('top', y);
}
else
{
y = y + 10;
$player.css('top', y);
}
}
$(document).keypress(move);
</script>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment