title: Scrolling Div Continuously in jQuery
body: <p>I have created jquery slider that will slide a next image when i click the next arrow. Now i need to show it continuously.(i.e) If a reach the last image in a slider. Then the first Image should scroll from the right. for that i tried jquery append. it's appending. But when i print the position it shows the old position.not the appended position.</p>
  
  <pre><code>&lt;div id="parent"&gt;
  &lt;div class="child"&gt;
  &lt;/div&gt;
  &lt;div class="child"&gt;
  &lt;/div&gt;
  &lt;div class="child"&gt;
  &lt;/div&gt;
  &lt;div class="child"&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  (i.e)//jQuery
  numberOfSlides = 4; //Total no of images
  $('arrow').click(function(){
  if(currentSlide == 2) //if i am in the second slide, then append first slide to the last slide
  {
     $('first-child').append('parent'); // This code is for reference. not in correct syntax.
  }
  else
  {
    for()//loop
    { 
      //sliding all images to the left (i.e)if the image width is 800px. then the slide animation will be  -800,0,800,1600 for(slide1,slide2,slide3,slide4).so that second image will show now.
     $('.child:nth-child('+loop_count+')').animate({'marginLeft','xxpx'});
    }
  }
  currentSlide++;
  });
  </code></pre>
  
  <p>The correct o/p when currentSlide 2 is -800,0,800,1600 for(slide2,slide3,slide4,slide1)
  In the above code if condition will append the first element to the parent element. But when i get the position of the appended element it is printing some -1600 px(when i check with the firebug,it is showing the div on the right side). but it should be 1600px; I am using marginLeft for positioning.</p>
  
  <p>Thanks </p>