1 | initial version |
To make the carousel indicator buttons react to mouse-clicks, the buttons need to be programmed to trigger a function or method when clicked. The function or method should change the active slide to the slide that corresponds to the clicked button.
Here is an example of how this can be done using jQuery:
$('.carousel-indicators li').click(function() {
// code to handle the click event goes here
});
var index = $(this).index();
$('.carousel-item').eq(index).addClass('active');
$('.carousel-item.active').removeClass('active');
$('.carousel-indicators li.active').removeClass('active');
$(this).addClass('active');
Putting it all together, the complete code for handling the click event on carousel indicator buttons would look like this:
$('.carousel-indicators li').click(function() {
var index = $(this).index();
$('.carousel-item').eq(index).addClass('active');
$('.carousel-item.active').removeClass('active');
$('.carousel-indicators li.active').removeClass('active');
$(this).addClass('active');
});