Skip to content

Instantly share code, notes, and snippets.

@DWboutin
Created July 19, 2013 16:44
Show Gist options
  • Save DWboutin/6040606 to your computer and use it in GitHub Desktop.
Save DWboutin/6040606 to your computer and use it in GitHub Desktop.
Boucle infini fadein fadeout slide
var timer = setInterval(function(){
for(var i = 0, liNbr = liEl.length; i < liNbr; i++){
liEl.eq(i).css({left: liEl.eq(i).position().left + 1 });
if(liEl.eq(i).position().left > liEl.eq(i).parent().width()){
if(!liEl.eq(i).is(':animated')){
liEl.eq(i).fadeOut(200, function(){
$(this).css({left: '0px'}).prependTo($(this).parent()).fadeIn(200);
});
}
}
}
}, 1000/60);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment