JSFiddle - React, Tailwind, and code Playground
HTML
<title>Loop Thumbnails</title>
<body>
<ul id="list">
<li class="list-item">
<span style="background-image:url(http://www.online-image-editor.com//styles/2014/images/example_image.png);" class="thumbnail"></span>
<span style="background-image:url(http://www.ac-grenoble.fr/ien.vienne1-2/spip/IMG/bmp_Image004.bmp);" class="thumbnail"></span>
<span style="background-image:url(http://arabst.com/files/images/621.jpg);" class="thumbnail"></span>
</li>
</ul>
</body>
CSS
.list-item {width:206px;height:206px;list-style-type:none;position:relative;}
.thumbnail {position:absolute;top:0;left:0;display:inline-block;width:206px;height:206px;background-position:center center;background-repeat:no-repeat;opacity:0;}
.thumbnail:first-child {opacity:1;}
JavaScript
jQuery(function($){
/*Loop through thumbnails*/
var loop = '';
$('.list-item').mouseover(function(){
var e = $(this);
loop = setInterval(function(){
$('span', e).filter(function(){
var match = '1';
return ($(this).css('opacity') == match);
}).animate({'opacity':'0'}).nextFirst().animate({'opacity':'1'}, 300);
}, 1000);
}).mouseout(function(){
clearInterval(loop);
});
});
/*Get next sibling if it exists. If not, get first sibling. Round & a round we go.*/
jQuery.fn.nextFirst = function(e){
var next = this.next(e);
return (next.length) ? next : this.prevAll(e).last();
}