If the carousel shown 4 items, to set the autoplay replaced with 4 new items. Here the demo if you click on the item pagination, you can see the effect. But if we set auto play, then change only one item?
$(".owlcarousel").owlCarousel({
autoplay: true,
margin: 10,
nav: true,
loop: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
});
php / html code (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>
I'd set slideBy
to your item count:
$(".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
In Owl Carousel 2 you use the option: slideBy:'page'
for sliding the entire "page" on autoPlay (or navigation buttons).
https://owlcarousel2.github.io/OwlCarousel2/docs/api-options.html
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.