1

I want to put animation for running car on the road vertically. As shown in my fiddle, the car animation does work, but I want the car to run on my image on the road and as the car goes farther away, the car should become smaller.

The Html Markup:

<div id="b" style="position:absolute;">   
          <img src="http://cliparts.co/cliparts/6Tr/ogp/6Trogpekc.png" style="width:10%"></div>  

The Jquery:

 $(document).ready(function () {          
        //for translate car
        function beeLeft() {
            $("#b").animate({ right: "+=1000" }, 6000, "swing", beeRight);
        }
        function beeRight() {
            $("#b").animate({ left: "+=1000" }, 6000, "swing", beeLeft);
        }

        beeLeft();

    });

Link to the fiddle : example fiddle

Any help is appreciated. Thank you in advance.

Devanshi Parikh
  • 265
  • 4
  • 12
shivani
  • 980
  • 1
  • 8
  • 29

0 Answers0