Return to Snippet

Revision: 70144
at December 3, 2015 01:15 by envane21


Initial Code
$('document').ready(function() {
  
    var $imgs = $('#slideshow > img'), current = 0;
    
    var nextImage = function() {
        if (current >= $imgs.length) current = 0;
        $imgs.eq(current++).fadeIn(function() {
            $(this).delay(3000).fadeOut(nextImage);
        })
    };
    nextImage();
  
});


HTML

<div id="slideshow">
          <img src="<?=$this->staticPath?>/img/girl01.jpg">
          <img src="<?=$this->staticPath?>/img/girl02.jpg">
          <img src="<?=$this->staticPath?>/img/girl03.jpg">
        </div>


CSS

#slideshow img {
  display: none;
}

Initial URL


Initial Description
Endless loop between 3 images

Initial Title
Loop between images

Initial Tags
images

Initial Language
jQuery