title: Moving object Left To Right
body: <p>In my game I am going to add obstaceles that move left to right across the <code>&lt;div id="outline"&gt;&lt;/div&gt;</code></p>
  
  <p>I've used <code>setInterval(){...}</code>  with the <code>.animate()</code> In it, and it seems to work only issue is after a little bit of time it leaves the ouline, Below is some code and a link.</p>
  
  <pre><code>$(document).ready(function() {
  setInterval(function(){
        $("#CObject").animate({
      'marginLeft' : "+=220px" //moves left
      }, 900);
   }, 900);
  setInterval(function(){
        $("#CObject").animate({
      'marginLeft' : "-=220px" //moves left
      }, 900);
   }, 1000);
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/mrj2q3p0/" rel="nofollow"><strong><em>Link.</em></strong></a></p>