Reputation: 15
Trying to get this to move across screen from left to right then down, I currently have this working to move the picture into the correct position ona button click, but it is not animated
function myMove()
{
var himg = document.getElementById( parameter.pictureID );
himg.style.left = (himg.style.left +1700) +"px";
himg.style.top = (himg.style.top+ 700) +"px";
setTimeout(myMove,20); // call doMove() in 20 msec
}
Upvotes: 0
Views: 499
Reputation: 211
you can achieve this with CSS3 transition;
http://www.w3schools.com/css/css3_transitions.asp
put transition: left 10s, top 10s; on the element you're moving, you can also benefit here from other transition capabilities
Upvotes: 1
Reputation: 9432
in thread how to move/slide an image from left to right setTimeout is called by
var animate;
animate = setTimeout(function(){moveRight();},20);
the move function is named moveRight()
there is also a jquery library
http://api.jquery.com/animate/
see the thread how to move/slide an image from left to right
Upvotes: 0