简体   繁体   中英

Owl Carousel problems (autoplay + responsive)

I'm using owlcarousel on my website, but I have a few problems. For one, the responsiveness isn't working properly. And for two, the carousel won't autoplay. You can see the issue here .

Here's my code:

$(".owl-carousel").owlCarousel({
    items: 1,
    loop: true,
    center: true,
    dots: true,
    autoplay: true,
    autoplayTimeout: 5000,
    autoplaySpeed: 5000,
    responsiveClass: true,
    responsive:{
      0:{
          items: 1 
      },
      600:{
          items: 1
      },
      1200:{
          items: 1
      }
  }
});

Update: I managed to fix the responsive issues by adding:

itemsDesktop: [1200, 1],
itemsTablet: [980, 1],
itemsMobile: [700, 1]

to the options.

Still, the autoplay isn't working.

here is my solution :

      $('.owl-carousel').owlCarousel({
            item:3,
            singleItem: true,
            autoplay: true,
            autoplayTimeout: 5000,
            loop: true,
            nav: true,
            responsiveClass: true,
            responsive:{
                0:{
                    items: 1,
                    dots: false
                },
                600:{
                    items: 2,
                    dots: false
                },
                1200:{
                    items: 3
                }
            }
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM