boostrap判斷當前slider的index
$('#carousel-id').on('slide.bs.carousel', function (e) {
var active = $(e.target).find('.carousel-inner > .item.active');
var from = active.index();
var next = $(e.relatedTarget);
var to = next.index();
to=to+1;
// console.log(from + ' => ' + to);
});
var active = $(e.target).find('.carousel-inner > .item.active');
var from = active.index();
var next = $(e.relatedTarget);
var to = next.index();
to=to+1;
// console.log(from + ' => ' + to);
});
留言
張貼留言