在桌面/移动设备上自定义OWL-Carousel 2



当前功能:旋转木马滑块将使用导航点,自动播放&手机中的阻力选项&桌面。

新规范:滑块将移至我的第五幻灯片&仅在移动设备中停止滑动(可拖动,自动播放),桌面保持不变。

当前代码:

var sliderHome = $("#mgs-slider");
sliderHome.owlCarousel({
    items: 1,
    rtl: RTL,
    loop: true,
    nav: true,
    dots: true,
    autoplayTimeout: 3000,
    autoplay: true,
    autoplayHoverPause: <?php echo $this->getStopAuto() ? 'true' : 'false'; ?>,
    animateOut: '<?php echo $animated['out'] ?>',
    animateIn: '<?php echo $animated['in'] ?>',
    <?php if($tpControls != 2): ?>
    navText: ["<i class='fa fa-caret-left'></i>","<i class='fa fa-caret-right'></i>"],
    <?php else:?>
        navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
    <?php endif;?>
    responsive:{
        0:{
            nav: false,
            dots: true
        },
        992:{
            nav: false,
            dots: false
        }
    }
});

您只需要将其添加到代码

sliderHome.trigger('to.owl.carousel', [4, 500, true]);
// 4 is the slide index
// 500 is the speed in ms - maybe you want 0 here

也许将其放入调整大小功能中,因此如果用户调整窗口

,它将反应

最新更新