-
-
Save shrutis22/c60ffcc38d265feeb4c2 to your computer and use it in GitHub Desktop.
Function to move a Div to its Left
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
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