2

我正在尝试使用 Owl carousel 2 创建一个将两个项目居中的滑块,而不是一个居中的选项。到目前为止,我已经设法通过在源代码中添加一些行来为居中项目左侧的项目添加一个额外的类。

if (this.settings.center) {
    this.$stage.children('.center').removeClass('center');
    this.$stage.children().eq(this.current()).addClass('center');
    this.$stage.children('.next-to-center').removeClass('next-to-center');
    this.$stage.children().eq(this.current() - 1).addClass('next-to-center');
}

但是当我显示四个项目时,我无法弄清楚如何使两个项目居中。我想将居中项目一侧的每个项目剪成两半。任何人都知道我该怎么做,或者推荐一个包含这个的库?

这是一个关于我到目前为止已经走了多长时间的例子

http://jsfiddle.net/7e97o5hn/4/

4

0 回答 0