Owlcarousel 2 change settings after init

DeLe picture DeLe · Oct 13, 2017 · Viewed 10k times · Source

I have already

var owl = $(".owl-carousel").owlCarousel({loop: true, nav: true}); 

I try change setting of loop or nav option but not working

owl.data('owl.carousel').settings.loop = false;
owl.data('owl.carousel').settings.nav = false;

How to do that thanks.

Answer

Zoya Ovdienko picture Zoya Ovdienko · Dec 1, 2017

For Owl Carousel 2 try refresh carousel after change options:

$('.owl-carousel').data('owl.carousel').options.nav = false;
$('.owl-carousel').trigger( 'refresh.owl.carousel' );