If you have a div with an image inside, like this:
<div style="width: 1000px"> <img src="truck.png" id="truck" style="margin-left: -100px" /> </div>
Here is a jQuery example for moving an image across a div / screen:
function moveTruck(){ $('#truck').animate( {'margin-left': '1000px'}, 3000, // Animation-duration function(){ $('#truck').css('margin-left','-100px'); moveTruck(); }); } moveTruck();
Hope it works out ...
source share