I try to use https://owlcarousel2.github.io/OwlCarousel2/
Plugin
But I have this error
Uncaught TypeError: Cannot read property 'fn' of undefined at owl.carousel.min.js:479 at owl.carousel.min.js:494
In this code
a.fn.owlCarousel = function (b) {
var c = Array.prototype.slice.call(arguments, 1);
return this.each(function () {
var d = a(this),
f = d.data("owl.carousel");
f || (f = new e(this, "object" == typeof b && b), d.data("owl.carousel", f), a.each(["next", "prev", "to", "destroy", "refresh", "replace", "add", "remove"], function (b, c) {
f.register({
type: e.Type.Event,
name: c
}), f.$element.on(c + ".owl.carousel.core", a.proxy(function (a) {
a.namespace && a.relatedTarget !== this && (this.suppress([c]), f[c].apply(this, [].slice.call(arguments, 1)), this.release([c]))
}, f))
})), "string" == typeof b && "_" !== b.charAt(0) && f[b].apply(f, c)
})
}
Here is how I use plugin in my code
<script>
$('#display').click(function () {
var vacancyId = $("#vacancy").val();
var model = {
vacancyId: vacancyId
};
$.ajax({
url: '@Url.Action("Links", "Questions")',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(model),
type: 'POST',
dataType: 'json',
processData: false,
success: function (data) {
var question2 = data;
for (var i = 0; i <= question2.length - 1; i++) {
var videoHTML = '<video width="320" height="240" style="margin-left: 130px;margin-top: 20px;" controls>';
videoHTML += '<source src="' + document.location.origin + "/uploads/" + question2[i].Linkes + ".webm" + '" type="video/webm">';
videoHTML += '</video>';
$(".videolist").append(videoHTML);
$(".videolist").owlCarousel();
}
}
});
});
</script>
How I can fix it?