【问题标题】:Owl carousel go to clicked item猫头鹰轮播转到点击的项目
【发布时间】:2015-04-20 09:10:25
【问题描述】:

我有 owl carousel v-2.0.0 有 5 个项目。

<div class="owl-carousel">
    <div class="item">
        <img src="img/1-m.png" alt="">
    </div>
    <div class="item">
        <img src="img/3-s.png" alt="">
    </div>
    <div class="item">
        <img src="img/2-l.png" alt="">
    </div>
    <div class="item">
        <img src="img/2-l.png" alt="">
    </div>
    <div class="item">
        <img src="img/1-m.png" alt="">
    </div>
</div>

和js来初始化它。

$(".owl-carousel").owlCarousel({
    loop: true,
    nav: true,
    responsive: {
        0: {
            items: 1
        },
        480: {
            items: 3
        },
        1000: {
            items: 5
        }
    }

});

旋转木马通过拖动工作?如何通过单击项目使其工作(单击的项目成为中心)。以及如何将自定义类添加到中心项?

【问题讨论】:

  • 解决问题并分享它。还提到猫头鹰轮播版本。
  • 您找到解决方案了吗?

标签: jquery carousel owl-carousel


【解决方案1】:
 $(document).on('click', '.owl-item', function () {
  owlIndex = $(this).index();
  $('.owl-stage-outer').trigger('to.owl.carousel', owlIndex);
});

【讨论】:

    猜你喜欢
    • 2015-06-27
    • 1970-01-01
    • 2022-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-10
    • 1970-01-01
    相关资源
    最近更新 更多