Сделал так, но пока получаю ту же ошибку Uncaught TypeError: $(...).data(...).addItem is not a function
$( document ).ready(function() {
$('#car-photo-carousel').owlCarousel({
autoplay:true,
autoplayTimeout:3000,
autoplayHoverPause:true,
items : 3,
responsiveClass:true,
nav:true,
navText: ["<i class=\"fa fa-chevron-left\" aria-hidden=\"true\"></i>","<i class=\"fa fa-chevron-right\" aria-hidden=\"true\"></i>"],
responsive:{
0:{
items:1,
nav:true
},
400:{
items:2,
nav:true
},
768:{
items:3,
nav:true
}
}
});
});
$('#car_id').on('change', function (e) {
var car_id = e.target.value;
$.post('/admin/getmodels/car', {car_id: car_id}, function (car) {
if (car.photos.length > 0) {
var counter = 0;
$.each(car.photos, function (index, photo) {
counter++;
var content = '<img class="img img-responsive" src="' + photo.file + '"/>';
$('#car-photo-carousel').data('owlCarousel').addItem(content,0);
});
} else {
$('#car-photo-carousel').append('<img class="cal-xs-8 img img-responsive" src="' + car.modelphoto[0].file + '"/>');
}
});
});