6

Bootstrap 2 seems to work fine handling the slide event (see this question) with the following code:

$('#myCarousel').bind('slide', function (e) {
    console.log('slide event!');
});

I cannot, however, get the same things to work in Bootstrap 3 (see this fiddle). Anyone know why?

Community
  • 1
  • 1
ringstaff
  • 2,331
  • 1
  • 16
  • 25

2 Answers2

23

Actual event namespace for slide according to bootstrap3 implementation is slide.bs.carousel as opposed to slide which was the one acc: to BS2, also use slid.bs.carousel to track completion of slide (though slid seems to work.)

So try:

$('#myCarousel').bind('slide.bs.carousel', function (e) {
    console.log('slide event!');
});

Demo

PSL
  • 123,204
  • 21
  • 253
  • 243
9

On Slide before

h('#HomeSlider').bind('slide.bs.carousel', function (e) {
   alert(h('#HomeSlider .item.active').html());
});

On Slide After

h('#HomeSlider').on('slid.bs.carousel', function (e) {
   alert(h('#HomeSlider .item.active').html());
});
Harikaran K
  • 428
  • 9
  • 26