OWL 2 Carousel Auto Play Not Working

天大地大妈咪最大 提交于 2019-12-13 14:43:29

问题


I have two slides going. I was using OWL 1 and it worked great. I would like the infinite loop, so moved to OWL 2.

The following code works great. The slides stay in sync, but autoplay never starts. I have to drag the slides or show the navigation and click next/prev.

Hoping the answer is pretty obvious to someone with more experience.

$(document).ready(function() {

var carousel_1 = $('#the_carousel'),
carousel_2 = $('#the_carousel_content');

carousel_2.on('change.owl.carousel', function(event) {
carousel_1.trigger('to.owl.carousel', [event.item.index,100,true]);

});

carousel_1.owlCarousel({
items:1,
loop:true,
autoPlay: true,
autoplayTimeout: 100,
slideBy: 1,
autoplaySpeed: 100,
 rewindNav: false
});

carousel_2.owlCarousel({
items:1,
loop:true,
autoPlay: false,
autoplaySpeed: 100,
autoplayTimeout: 100,
nav:false,
slideBy: 1,
rewindNav: false
});

});
</script>

Thanks!


回答1:


Consider the typo at:

autoPlay: true,

it must be:

autoplay: true,

And for the ones who has downloaded the development version of library must be careful that the autoplay plugin is not included as user em2 said.




回答2:


this guy had the same problem: Owl Carousel Will Not Autoplay

you need to manually add autoplay.js library from owl site

<script src="owl/js/owl.autoplay.js"></script>


来源:https://stackoverflow.com/questions/27430514/owl-2-carousel-auto-play-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!