如何使用猫头鹰旋转木马连续滑动旋转木马

Jak*_*kub 1 javascript jquery slide carousel

我想要做的是,带有 Owl Carousel 插件的徽标将连续滑动(没有 1,2,3... 秒延迟,但不会停止滑动) Owl Carousel 是否可能?

小智 5

Here is how I got owl carousel to constantly scroll.

I had to add in a trigger to start the loop as the autoplay was too long, and meant it didn't start straight away, then I have a second trigger that sets the speed back to match the main setting.

You need to make sure that autoplaySpeed and smartSpeed are set to the same timing, and that slideTransition is set to linear.

jQuery(document).ready(function() {
    jQuery('.owl-carousel').owlCarousel({
    loop: true,
    items: 6,
    autoplay: true,
    slideTransition: 'linear',
    autoplaySpeed: 6000,
    smartSpeed: 6000,
    center: true,
    });


    jQuery('.owl-carousel').trigger('play.owl.autoplay',[2000]);

    function setSpeed(){
        jQuery('.owl-carousel').trigger('play.owl.autoplay',[6000]);
    }

    setTimeout(setSpeed, 1000);
});
Run Code Online (Sandbox Code Playgroud)