Skip to content

Instantly share code, notes, and snippets.

@shrutis22
Created January 15, 2016 07:11
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 shrutis22/c60ffcc38d265feeb4c2 to your computer and use it in GitHub Desktop.
Save shrutis22/c60ffcc38d265feeb4c2 to your computer and use it in GitHub Desktop.
Function to move a Div to its Left
function leftMove(pressedKey) {
if (pressedKey.keyCode === 37) {
var left = $(".player").css("left");
var newLeft = parseInt(left) - 100;
if (newLeft >= 0) {
$(".player").css("left", newLeft);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment