0

嗨,我想调用一些关于轮播图像更改的代码,我该怎么做?这是要滑动的代码。请帮忙

JS代码:

 $("#carousel-items").carousel({
    "dot-controls": true,
    "autoplay": true,
    "autoplay-interval": 7000,
    "scroll-speed": 800,
    "skip-speed": 0,
    "left-slide-selector": "#control-left",
    "right-slide-selector": "#control-right"
 });

我想要做的是当轮播中的图像发生变化时,我想为此生成一个事件处理程序

谢谢:)

4

2 回答 2

3

嗨,我知道这是一个老问题,这是 bootstrap 3 的答案

$('#myCarousel').bind('slide.bs.carousel', function (e) {
    console.log('slide event!');
});
于 2015-08-19T14:48:03.703 回答
0

Assuming you're using the Twitter Bootstrap Carousel (since you didn't specify):

// This event fires immediately when the slide instance method is invoked.
$("#carousel-items").on("slide", function(){
    // do something
});

// -- OR --

// This event is fired when the carousel has completed its slide transition.
$("#carousel-items").on("slid", function(){
    // do something
});
于 2013-07-16T13:18:37.293 回答