Is there a way in Owl Carousel 2 make a king random function. I need the slides on the page to load randomly.
Before in the older Owl Carousel version I did it this
You have to use the new onInitialize
callback, like this:
var owl = $('.owl-carousel');
owl.owlCarousel({
onInitialize : function(element){
owl.children().sort(function(){
return Math.round(Math.random()) - 0.5;
}).each(function(){
$(this).appendTo(owl);
});
},
});
Find more information in the 2.x docs.