continuous movement
I would like to recreate the truck moments in the above site , It is done in mootools. How would I code this, is there a jQuery plugin to do this?
So animate an object from beginning to end of screen and then it starts over again. How would I do this jQuery
Any help will e appreciated
Here's a JSFiddle sample http://www.jsfiddle.net/XpAjZ/
More on jQuery animate: http://api.jquery.com/animate/
Demonstration shows 2 boxes animated across the screen at different speeds etc. (See fiddle)
Relevant jQuery Code:
var animateMe = function(targetElement, speed){
$(targetElement).css({left:'-200px'});
$(targetElement).animate(
{
'left': $(document).width() + 200
},
{
duration: speed,
complete: function(){
animateMe(this, speed);
}
}
);
};
animateMe($('#object1'), 5000);
animateMe($('#object2'), 3000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With