Sliding through divs at interval - jQuery

Posted by phil on Stack Overflow See other posts from Stack Overflow or by phil
Published on 2010-05-17T18:54:18Z Indexed on 2010/05/17 19:10 UTC
Read the original article Hit count: 130

Filed under:

Hey,

I have a list of around 30 divs (see below.) and would like to hear any suggestions on the best way to rotate through them by sliding in one at the top and removing one from the bottom at a set time. Something like every 5-10 seconds. Also even though there are 30 on the page I would only like to show a list of 10 and have the rest show as mentioned.

A great example would be www.foursquare.com and their recent activity section. I would like to do the same except with a predetermined amount of divs instead of real-time using ajax.

Any suggestions or a bit of help pointing me in the right direction would be greatly appreciated.

<div class="recent-questions">

<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>

<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>
<div class="recent-question"></div>

</div>

Thanks in advance for any help or thoughts!

© Stack Overflow or respective owner

Related posts about jQuery