gpt4 book ai didi

javascript - 自动播放多个项目?

转载 作者:行者123 更新时间:2023-11-29 16:58:27 25 4
gpt4 key购买 nike

如果轮播显示 4 个项目,设置自动播放替换为 4 个新项目。这里是demo如果你点击项目分页,你可以看到效果。但是如果我们设置自动播放,那么只改变一个项目?

$(".owlcarousel").owlCarousel({
autoplay: true,
margin: 10,
nav: true,
loop: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
});

php/html 代码 (cakephp)

    <?php $brands = $this -> requestAction('/brands'); ?>
<div class="featured-brands">
<div class="container">
<div class="col-xs-12">
<div class="owlcarousel">
<?php foreach ($brands as $brand) {?>
<div class="item"><?php echo $this->Html->image('brands/'.$brand['Brand']['id'].'/'.$brand['Brand']['image'],array('class'=>'img-responsive')); ?></div>
<?php } ?>
</div>
</div>
</div>
</div>

最佳答案

我将 slideBy 设置为您的项目数:

$(".owlcarousel").owlCarousel({
autoplay: true,
margin: 10,
nav: true,
loop: true,
responsive: {
0: {
items: 1,
slideBy: 1
},
600: {
items: 3,
slideBy: 3
},
1000: {
items: 5,
slideBy: 5
}
}
});

https://owlcarousel2.github.io/OwlCarousel2/docs/api-options.html#slideby

关于javascript - 自动播放多个项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30195858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com