Reset Autoplay of Owl Carousel when user manually skip to next slide

34 views Asked by At

Hey guys i'm having issues an Owl Carousel, it doesn't reset the Autoplay Timeout when user skips to the next slide. The slides changes each 5 seconds, nevertheless when an user change it manualy to the second slide after 2.5 secs, the slide changes again to quickly and it's annoying .

Anyone knows the solution? Please.

I leave the code down below

$( document ).ready(function() {
  var tiempo = $('.datos-slider').attr("data-time")+'000';
  var tipo = $('.datos-slider').attr("data-tipo");
  
  console.log(tiempo);
  $('.owl-carousel.carousel-principal').owlCarousel({
    autoplay:true,
    autoplayTimeout: tiempo ,
    loop:true,
    margin:0,
    items:1,
    nav:tipo == 1 ? true:false,
    dots:tipo == 2 ? true:false,
    pullDrag:false,
  });

I tried to set stop the the autoplay with the next function:

    owl.on('changed.owl.carousel', function(e) {
        owl.trigger('stop.owl.autoplay');
        owl.trigger('play.owl.autoplay');

But it doesn't work. I'm expecting to restart the time to 0 when someone changes the slide manually by clicking on the dots

0

There are 0 answers