cancel
Showing results for 
Search instead for 
Did you mean: 

How can I fix? Uncaught TypeError: $(...).owlCarousel is not a function at yttheme.min.js:2

How can I fix? Uncaught TypeError: $(...).owlCarousel is not a function at yttheme.min.js:2

Hello,

I get this error on all pages. (Magento 2.3)

My English not perfect sorry. 

How can I fix? Thanks.

Ekran Resmi 2018-12-27 18.07.46.png

3 REPLIES 3

Re: How can I fix? Uncaught TypeError: $(...).owlCarousel is not a function at yttheme.min.js:2

Hi @Ercan KOKSEL,

 

This error might be caused if you called the owlCarousel function after including the jQuery file but before including the owl-carousel file.
In this case the owlCarousel function is not yet defined in the jQuery scope.
To be sure everything is loaded you might prefer using: $(window).load() instead or inside of $(document).ready().
Finally, you can avoid library conflicts, if any, with a syntax like this:
jQuery(function($){ ...your code... });

Prema M

Re: How can I fix? Uncaught TypeError: $(...).owlCarousel is not a function at yttheme.min.js:2

Hello @Ercan KOKSEL

 

You can solve this error using following way.

 

Open your Owlcarausel Js file (The js file which comes with the Owlcarousel library. It could be owlcarousel.js or owlcarousel.min.js)

 

Wrap all the code in require function as given below.

 

require(['jquery'], function($) {
/* default code of the file */
});

 

If you find my answer useful, Please click Kudos & Accept as Solution.

Re: How can I fix? Uncaught TypeError: $(...).owlCarousel is not a function at yttheme.min.js:2

Sorry i am not able to get you . Can you please tell me what you mean by ' Wrap Up Code "  This is the code of my owl carousel file . Please let me know what i have to change ?

 

JQuery Code.png