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');
});
You can first of all, use an if
loop: $('.owl-carousel img').length > 1 ? true : false,
This will measure the amount of img
s in the carousel, and disable the loop. We can also add an if to use the hide()
function