Fixes #13297: Carousel indicator not working

JQuery's index() function is not working sometimes. Using prevAll() instead avoids the problem.