Bootstrap触摸旋转木马需要无限循环

时间:2014-09-24 04:34:57

标签: twitter-bootstrap carousel

在Bootstrap轮播中,我添加了触控支持(bootstrap-touch-carousel.js)。在该间隔周期停止工作之后,它将在最后一次幻灯片后停止我想要它无限循环。它在网络上工作但不在移动设备上工作。我的代码如下:

$('.carousel').carousel({ 
                interval: 2000,
                pause: "false"
                  });

1 个答案:

答案 0 :(得分:0)

这是解决方案,对我有用:

查找

f.prototype._showPane = function(a) {
  this.$items.eq(this.current_pane).toggleClass("active"), a >= this.pane_count && this.pause(), a = Math.max(0, Math.min(a, this.pane_count - 1)), this.$items.eq(a).toggleClass("active"), this.current_pane = a;
  var b = -(100 / this.pane_count * this.current_pane);
  return this._setContainerOffset(b, !0, a), this
}

替换为:

f.prototype._showPane = function(a) {
  if (a >= this.$items.length){ a = 0; }
  this.$items.eq(this.current_pane).toggleClass("active"), a >= this.pane_count && this.pause(), a = Math.max(0, Math.min(a, this.pane_count - 1)), this.$items.eq(a).toggleClass("active"), this.current_pane = a;
  var b = -(100 / this.pane_count * this.current_pane);
  return this._setContainerOffset(b, !0, a), this
}

<a href="http://clustersystems.devrun.com/frontapp/js/bootstrap-touch-carousel-custom.js">Here the JS library</a>