Twitter Bootstrap Carousel – access current index

Instead of adding and subtracting from the current slide, try this on the ‘slide’ event:

$('.carousel').on('slide',function(e){
    var slideFrom = $(this).find('.active').index();
    var slideTo = $(e.relatedTarget).index();
    console.log(slideFrom+' => '+slideTo);
});

Leave a Comment