javascript – .owlCarousel() function doesn't resolve as a function-ThrowExceptions

Exception or error:

I want to use owl carousel and I’ve added the related files in my index.php file but still the .owlCarousel() function doesn’t resolve . Here is my related links to owl carousel in the head of my HTML file :

<link rel="stylesheet" href="css/jquery-ui.css">
<!-- owl carousel external css files: -->
<link rel="stylesheet" href="css/owl.carousel.min.css">
<link rel="stylesheet" href="css/owl.theme.default.min.css">
<link rel="stylesheet" href="css/jquery.fancybox.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.carousel.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.theme.default.min.css" rel="stylesheet" />

And in end of body tag I include my js files:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" defer></script>
<script src="js/jquery-3.3.1.min.js" type="c4ab72ba033bc5e53971138c-text/javascript" defer></script>


<script src="js/jquery-migrate-3.0.1.min.js" type="c4ab72ba033bc5e53971138c-text/javascript" defer></script>
<script src="js/jquery-ui.js" type="c4ab72ba033bc5e53971138c-text/javascript" defer></script>
<script src="js/popper.min.js" type="c4ab72ba033bc5e53971138c-text/javascript" defer></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" defer></script>

<script src="js/owl.carousel.min.js" type="c4ab72ba033bc5e53971138c-text/javascript" defer></script>

<!-- My script file -->
<script src="js/owl-carousel-custom.js" type="text/javascript" defer></script>

and in my owl-carousel-custom.js I am trying to write some owl carousel code :

$(document).ready(() => {

  $('.owl-carousel').owlCarousel({
    loop: true,

  })

});

But .owlCarousel() doesn’t resolve as a function.Why?
Here is a screenshot of my IDE:

enter image description here

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *