10-17-2013, 05:02 AM | #1 |
Registered User
Join Date: Jul 2013
Posts: 173
|
DHTML animation question?
I wonder if anyone could help me with this simple DHTML movement question. I am trying to get my ball to go right then left in a smooth manner. I can get it to go right fine, but it jerks back to the left. I have tried all sorts of variables but it doesn't seem to want to work. The code is this:
<html> <head> <script language = "javascript"> dir = 0 function move() { if(dir == 0) { ball.style.pixelLeft +=3 if(ball.style.pixelLeft>=400) ball.style.pixelLeft =-3 } else if(ball.style.pixelLeft<20) { ball.style.pixelLeft +=3} setTimeout("move()", 30) } </script> </head> <body onload="move()"> <img src = "ball.jpg" style="position: absolute; left: 30px; width: 100px; height: 100px" id="ball"> </body> </html> give me your advice please Web Designing Companies in Delhi | Wedding Planners in Delhi | Event Management Companies in Delhi Last edited by fredpeterson543; 02-07-2016 at 01:19 AM.. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to drive traffic using forum / asking question website? | dewanshahedur | Traffic Corner | 8 | 10-13-2013 01:22 AM |
Askoverflow.com :A Question Answering Website to Get Free Backlinks | IamRobin | Post your ad here | 0 | 03-26-2013 10:18 AM |
Question about using php with dhtml tables | wryfhk22 | PHP / mySQL | 0 | 09-17-2011 01:59 AM |