I have a webpage that contains an image and some links. Each of the links execute different functions when clicked.
When a certain link is clicked, I call a function called move. When this link is clicked, I need the image (bird) to move 20px to the right.
So far, my function looks like this:
function move(e) {
bird.style.position = "relative";
bird.style.left += "20px";
e.preventDefault(); //prevents the page from redirecting
}
This works, but only one time. When I click the link, bird will move 20px to the right, but this will only happen once. I need the photo to move 20 more px EVERY time the link is clicked. A friend told me to "parse it before adding it" but I'm not really sure what they mean. What should I be parsing? Any suggestions/help are very appreciated. Thanks!