How to attach “slide” & “slid” events to the Bootstrap toolkit's carousel?

后端 未结 3 545
借酒劲吻你
借酒劲吻你 2020-12-14 17:16

Here\'s a fiddle with a working Bootstrap carousel. http://jsfiddle.net/jeykeu/5TDff/

And here\'s the official documentation which tells nothing about event usage. h

3条回答
  •  余生分开走
    2020-12-14 17:37

    Based on your fiddle #carousel is wrong. It should be #myCarousel.

    Updated Example:

    $('#myCarousel').carousel({
        interval: 2000
    });
    
    // Could be slid or slide (slide happens before animation, slid happens after)
    $('#myCarousel').on('slid', function() {
        alert("Slide Event");
    });​
    

    http://jsfiddle.net/infiniteloops/wPF3n/

    With Bootstrap 3

    http://jsfiddle.net/infiniteloops/wPF3n/252/

提交回复
热议问题