title: How to make jQuery Mobile scrollview scroll infinitely left and right so the elements repeat back on themselves?
body: <p>Basically the same as this question: <a href="https://stackoverflow.com/questions/5359372/how-to-make-an-infinitely-long-scroll-view-on-iphone">How to make an infinitely long scroll view on iPhone?</a> but using jQuery Mobile not objective C.</p>
  
  <p>I'm using this plugin: <a href="http://jquerymobile.com/test/experiments/scrollview/scrollview-direction.html" rel="nofollow noreferrer">http://jquerymobile.com/test/experiments/scrollview/scrollview-direction.html</a> in particular the example under "Horizontal Scrollview". I want it to loop back on itself so when the user gets to the far right, it will go back to the start and if they scroll left from the start it will go to the end.</p>
  
  <p>I'm not bothered if the solution uses the scrollview plugin in particular or not just that it can have a similar effect.</p>
  
  <p><strong>UPDATE:</strong> I eventually did a different way as moving elements to the end or the start of the list seemed flickery with jQuery Mobile scrollview on an iPhone.</p>
  
  <p>What I did was copy all of the li elements within the ul 3 times, so that it was 4 times longer. Then at the start of the script, position the scroll point at the start of the 3rd copy (so the left most point of the screen was exactly half way along the length of the list).</p>
  
  <p>Then whenever the scroll position went beyond the start of the 4th copy, simply move the scroll position back to the middle (offset by how many pixels over it went). Then the same in reverse, triggering it went it went beyond the start of the 2nd copy. Reason I needed 4 copies was so there was a bit of leeway when you scrolled left fast and it went beyond the start of the 2nd copy.</p>