Owl Carousel Won't Autoplay

后端 未结 15 1205
失恋的感觉
失恋的感觉 2020-12-01 18:06

I\'m using the Owl Carousel on my site. According to their documentation, this piece of JavaScript should work:



        
相关标签:
15条回答
  • 2020-12-01 18:23

    You are may be on the wrong owl's doc version.

    autoPlay is for 1st version
    
    autoplay is for 2nd version
    
    0 讨论(0)
  • 2020-12-01 18:24

    You should set both autoplay and autoplayTimeout properties. I used this code, and it works for me:

    $('.owl-carousel').owlCarousel({
                    autoplay: true,
                    autoplayTimeout: 5000,
                    navigation: false,
                    margin: 10,
                    responsive: {
                        0: {
                            items: 1
                        },
                        600: {
                            items: 2
                        },
                        1000: {
                            items: 2
                        }
                    }
                })
    
    0 讨论(0)
  • 2020-12-01 18:25

    With version 2.3.4, you need the to add the owl.autoplay.js plugin. Then do the following

    var owl = $('.owl-carousel');
    owl.owlCarousel({
       items:1, //how many items you want to display
        loop:true,
        margin:10,
        autoplay:true,
        autoplayTimeout:10000,
        autoplayHoverPause:true
    });
    
    0 讨论(0)
  • 2020-12-01 18:25

    Your Javascript should be

    <script>
    $("#intro").owlCarousel({
    
    // Most important owl features
    
    //Autoplay
    autoplay: false,
    autoplayTimeout: 5000,
    autoplayHoverPause: true
    )}
    </script>
    
    0 讨论(0)
  • 2020-12-01 18:28

    If you using v1.3.3 then use following property

    autoPlay : 5000
    

    Or using latest version then use following property

    autoPlay : true
    
    0 讨论(0)
  • 2020-12-01 18:29
    1. First, you need to call the owl.autoplay.js.

    2. this code works for me : owl.trigger('play.owl.autoplay',[1000]);

    0 讨论(0)
提交回复
热议问题