Thank you very much! How to move continuously (very fast and continuously)?

thetenfold
—
2013-10-03T01:07:01Z —
#5

What do you mean continuously? back and forth? Use window.setInterval to find when it gets to either side and have it fade the opposite way.

8Observer8
—
2013-10-03T07:27:03Z —
#6

I want to move div how a "small car".

Stomme_poes
—
2013-10-03T15:02:35Z —
#7

thetenfold said:

What do you mean continuously? back and forth? Use window.setInterval to find when it gets to either side and have it fade the opposite way.

I think this div needs to be moved like Link in Legend of Zelda. So instead, he probably needs to listen for repeated key events as the key is held down (the key keeps making new events while it is held down?).

Probably the script is slow because for each key it's findgin .square again and again. It should be faster if .square is found once and saved into a variable. Before document.onkeydown event listener.