2

I'm looking for a way to hide the Owl Carousel custom navigation, and to stop the "loop" functionality if there is only one item.

$('.owl-carousel').owlCarousel({
    loop: true,
    items: 1,
});

owl = $('.owl-carousel').owlCarousel();
$(".prev").click(function () {
    owl.trigger('prev.owl.carousel');
});
$(".next").click(function () {
    owl.trigger('next.owl.carousel');
});

Fiddle

Schakelen
  • 115
  • 1
  • 3
  • 9

1 Answers1

5

You can first of all, use an if

loop: $('.owl-carousel img').length > 1 ? true : false,

This will measure the amount of imgs in the carousel, and disable the loop. We can also add an if to use the hide() function

Fiddle

Downgoat
  • 13,771
  • 5
  • 46
  • 69