javascriptjqueryowl-carouselowl-carousel-2

Event to.owl.carousel and items > 1


Why does event to.owl.carousel work incorrectly with items > 1? When I try to switch to slide 1, it scrolls through 2 slides in a row instead.

https://codepen.io/photosho/pen/abqKJbw


Solution

  • Following this issue, they address that the to.owl.carousel will take 3 params [position, speed, offset].

    https://github.com/OwlCarousel2/OwlCarousel2/issues/421

    Please try the below code:

    $('.button').on('click', function() {
        $('.owl-carousel').trigger('to.owl.carousel', [$('input').val(), 100, 1]);
      });