本文介绍了OWL 2轮播自动播放无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要放两张幻灯片.我使用的是OWL 1,效果很好.我想要无限循环,所以转到OWL 2.
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>
谢谢!
推荐答案
在以下位置考虑拼写错误:
Consider the typo at:
autoPlay: true,
它必须是:
autoplay: true,
对于下载了库的开发版本的用户,请务必注意,em2用户所说的自动播放插件不包含在内.
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.
这篇关于OWL 2轮播自动播放无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!