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

留言

這個網誌中的熱門文章

PHP讀資料庫的資料,保留換行及空格

CSS animation 簡寫&好用的工具

使陣列裡的數值隨機重新排序