$(document).ready(function(){ rotatePics(1); }); function rotatePics(currentPhoto){ var numberOfPhoto=$(‘#photos img’).length; currentPhoto=currentPhoto % numberOfPhoto; $(‘#photos img’).eq(currentPhoto).fadeOut(function(){ $(‘#photos img’).each(function(i){ $(this).css( ‘zIndex’,((numberOfPhoto-i)+currentPhoto) % numberOfPhoto );
