With the code below, when I click on MY BUTTON, the item number 3 is shown.
$('#myButton').click(function () {
$('#myCarousel').carousel(3);
});
-
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">0</div>
<div class="item">1</div>
<div class="item">2</div>
<div id="myItem3" class="item">3</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
<a id="myButton">MY BUTTON</a>
</div>
Is there a way to show the item by his Id, not his index ?
somehting like that :
$('#myButton').click(function () {
$('#myCarousel').carousel($('#myItem3'));
});