然后我想自动播放猫头鹰轮播 我认为它来自stackoverflow中的一些帖子,但不起作用
.js->
$(document).ready(function(){
owl = $(".owl-carousel");
owl.owlCarousel({
loop:true,
autoplaySpeed:1000,
items:5,
autoplay:true
});
});
我的html->
<div class="container awards mt-5">
<h1 class="text-title text-red">
Awards
</h1>
<div class="owl-carousel owl-six" data-inner-pagination="true" data-white-pagination="true" data-nav="false" data-autoPlay="true">
{% for item in page.awards.all %}
{% image item.image width-2048 as event_image %}
<div class="award-image" style="background-image:url({{ event_image.url }})"></div>
{% endfor %}
</div>
</div>
答案 0 :(得分:0)
1000
的值将使滑块自动播放。
编辑您的滑块文件并向其中添加autoplay:true
,而不是粘贴整个代码段。
如果您在参数末尾添加autoplay:true
作为最后一个参数,则不需要逗号autoplay:true
。但是,如果将其添加到中间,则将需要这样的逗号:,
此外,如果您希望滑块每5秒自动旋转一次,则将true值替换为5000。例如:autoplay:true,