Add loop function to carousel.