Update Javascript to check for infinite carousel.