开发者

how to loop a function in jquery

开发者 https://www.devze.com 2023-03-24 20:04 出处:网络
hi 开发者_JAVA技巧im making this image fadeIn and then fadeout again but i have no idea how to loop it.

hi 开发者_JAVA技巧im making this image fadeIn and then fadeout again but i have no idea how to loop it.

<div class="slideshow">
<img src="img1.jpg">
<img src="img2.jpg">
<img src="img3.jpg">
<img src="img4.jpg">
<img src="img6.jpg">
<img src="img7.jpg">
<img src="img8.jpg">
<img src="img9.jpg">
<img src="img10.jpg">
</div>

            var lis = $('.slideshow img').hide();
            $('img:first',lis).show();
            var x=0;
            (function displayImages() {
                lis.eq(i++).fadeIn(600, displayImages);

            })();


$('.slideshow img:first-child').fadeIn(500, fadenext);

function fadenext() {
  $(this).next().fadeIn(500, fadenext);
}

http://jsfiddle.net/imoda/4CKbZ/


Maybe you could use the fadein callback method to call the next one...

.fadeIn( 600, NextImage );

0

精彩评论

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