title: Infinite carousel with variable items
body: <p>I’m trying to create carousel component similar to <a href="http://jqueryfordesigners.com/jquery-infinite-carousel/" rel="nofollow">this one</a>, and basically this implementation is what I’m looking for, but what it doesn’t handle (or doesn’t have as an option) is slides with variable number of items in them.</p>
  
  <p>What I’m talking about is this: implementation mentioned in link works with 3 items in each slide, and if last slide doesn’t have exactly 3 items, it fills that slot with empty item. Which is reasonably good way of making infinite implemenation easy.</p>
  
  <p>I tried to modify it to fill that empty slot with first item in list if only one slot is empty, first two items if two slots are empty, etc. but I stumbled on problem where next set of slides has completely different display and logic and therefore animation becomes "glitchy"—e.g. going back to "start" first slide would have second, third and fourth item without first item if only one slot in last slide is empty.</p>
  
  <p>My current "workaraound" is cloning, appending and prepending items on every reposition (clicking of controls buttons), but this is highly non-performant (manipulating DOM every time and caching new set of elements based on original selector can be costly) and probably "lazy way out".</p>
  
  <p>Is there any clever solution for this problem?</p>