I am creating a carousel with infinite loop in my website by using Owl-Carousel 2 but whatever I've tried, I could not make the carousel work. The carousel always moves little bit and comes back, it kind of stuck.
I have tried without loop and just autoPlay, then it works but no looping. Also, if I add autoplayHoverPause: true, with loop:true, it does not work unless I hover on the carousel, then it slides but of course loop still does not work.
My Js;
$('.award-full-slider').each(function () {
if ($(this).find('.item').length > 1) {
$(this).addClass('owl-carousel').owlCarousel({
loop: true,
autoplay : true,
slideTransition: 'linear',
autoplayTimeout : 10,
autoplaySpeed : 15000,
mouseDrag: false,
dots: false,
nav: false,
autoplayHoverPause: true,
responsive:{
0:{
items:2,
nav:false,
loop:true,
},
600:{
items:4,
nav:false,
loop:true,
},
1000:{
items:6,
nav:false,
loop:true,
}
}
});
}
});
The PHP loop code;
<div class="home-award-area wrapper column" style="color:#0081ac !important">
<div class="home-award row-cont">
<div class="award-title"><a href="<?php echo home_url('news') ?>" class="action underline">Awards & Rankings</a></div>
<div class="items award-full-slider">
<?php
$query = new WP_Query(array(
'post_type' => 'award',
'posts_per_page' => 30,
'orderby' => 'date',
'order' => 'DESC',
));
while ($query->have_posts()) : $query->the_post();
$info = get_post_meta(get_the_ID(), '_post_info', true); if (!$info) $info = array();
$post_elem=get_post();
$postType = get_post_type_object(get_post_type());
?>
<div class="item">
<div class="content">
<div class="country">
<?php
$term = get_the_terms($ID,'award-country');
if ( ! empty( $term ) ) {
$term = $term[0];
?>
<?php echo $term->name ?>
<?php
}
?>
</div>
<div class="category">
<?php
$term = get_the_terms($ID,'award-category');
if ( ! empty( $term ) ) {
$term = $term[0];
?>
<?php echo $term->name ?>
<?php
}
?>
</div>
<div class="title">
<?php the_title() ?>
</div>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
</div>
</div>
</div>
Thank you for your help