开发者

How to repeat simple jQuery slideshow

Trying to adapt snook.ca's Simplest jQuery Slides for multiple, nested elements. I've got the cycle working, although I'm sure my jQuery is a bit verbose. I can't, however, figure out how to return the script to the beginning of the set of elements so it repeats an endless loop. Snook's script uses appendTo to return to the beginning and re-create the stack but I'm lost as to how to put this

Here is the HMTL (there are 4 (fixed) instances of these list items):

<li开发者_开发百科 class="current">
  <h3>...</h3>
  <p><img src="..."><span>...<a href="...">...</a></span></p>
</li>

And here is the jQuery (it's the <p> elements which are being cycled):

$(document).ready(function() {
  $('header nav li').not('.current').children('p').hide();
     setInterval(function(){
   $('header nav li.current').children('p')
       .hide().parent('li').removeClass().next('li')
       .addClass('current').children('p').show().end();
       },3000);
 });

Thanks for any help you can give me!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜