0

I have a img-tag (a bird) and I want to animate it from right to left with jQuery. it is supposed to fly in an out again and again.

quite like the little yellow helicopter flying through the sky on this website: http://www.abramsbooks.com/wesandersoncollection/

can somebody please help me?

  • See this answer : http://stackoverflow.com/questions/16482499/jquery-to-animate-image-from-left-to-right-continously And there is a working example :) – Kevin Labécot Jun 18 '14 at 16:56
  • hmm, the spritely-thing? I've downloaded it, but I hardly know any jQuery and I don't know which parts of the plugin I need.. :( – user3753468 Jun 18 '14 at 17:08
  • No, read this : http://stackoverflow.com/a/16485940/911718 And this fiddle : http://jsfiddle.net/tTman/ – Kevin Labécot Jun 18 '14 at 17:27
  • but in the fiddle the cloud is not moving through the window like the helicopter in my example: http://www.abramsbooks.com/wesandersoncollection/ – user3753468 Jun 18 '14 at 17:36

1 Answers1

0

First you get the width of your window, in this case im using the container div i just created, then you just need to loop it. Of course this is very simple but it should give u an idea.

var width = $('#container').width();

function loop() {
        $('#chopper').css({left:0});
    $("#chopper").animate({"left":width}, 5000, "linear", function(){
            loop();
     });
}
loop();

Jsfiddle http://jsfiddle.net/ap8n3/

Jorge Faianca
  • 791
  • 5
  • 11