【问题标题】:Bootstrap touch carousel need to be infinite loopBootstrap触摸轮播需要无限循环
【发布时间】:2015-03-19 06:31:36
【问题描述】:

在 Bootstrap 轮播中,我添加了触摸支持(bootstrap-touch-carousel.js)。在该间隔循环停止工作后,它将在最后一张幻灯片后停止,我希望它无限循环。它适用于网络,但不适用于移动设备。我的代码如下:

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

【问题讨论】:

  • 什么是 bootstrap-touch-carousel.js 或者它来自哪里?

标签: twitter-bootstrap carousel


【解决方案1】:

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

查找:

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>

【讨论】:

    猜你喜欢
    • 2019-03-18
    • 1970-01-01
    • 1970-01-01
    • 2022-11-08
    • 2020-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-04
    相关资源
    最近更新 更多