嗨,我想调用一些改变旋转木马图像的代码,我该怎么做? 这是要滑动的代码。请帮忙
JS CODE:
$("#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"
});
我想要做的是当轮播中的图像发生变化时我想为其生成一个事件处理程序
感谢:)
答案 0 :(得分:2)
嗨,我知道这是一个老问题,这是bootstrap 3的答案
$('#myCarousel').bind('slide.bs.carousel', function (e) {
console.log('slide event!');
});
答案 1 :(得分:0)
假设您正在使用Twitter Bootstrap Carousel(因为您未指定):
// 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
});