How do I tell Bootstrap Carousel to jump to a specific index?

I am using Bootstrap and Bootstrap Carousel in a project.

I would like to know if there is a way to get Carousel to go to a specific slide.
For example, something like:

$('myCarousel').to(2);

Does anyone know a way to do this?

+5
source share
2 answers

From the documentation:

. carousel (number) A carousel loop to a specific frame (based on 0, like an array).

Therefore, I think it should be:

 $('myCarousel').carousel(2);
+14
source

Select your carousel item using jQuery and use the method .carousel():

$("#myCarousel").carousel(2);

This will lead you to the third slide.

0
source

All Articles