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);
    });

發表迴響