Uncaught typeError: Cannot read property 'owlCarousel' of null

本小妞迷上赌 提交于 2019-12-23 03:38:10

问题


I am having a jQuery Issue, Understand I am no jQuery expert so bear with me. I am trying to install this Owl Responsive slider on magento and I am having an issue with this "

Uncaught typeError: Cannot read property 'owlCarousel' of null in Chrome console

Thanks.


回答1:


By default magento use prototypejs framework which uses $ as global variable. if you include other javascript plugins like jQuery which also use $ as global variable, there will be a clash in variables related to prototypejs and jquery. This conflict can be resolved by assigning different name to global variable of jquery plugin.

To do that, use the following code above in all files wherever you are planning to use jQuery instead of prototype.

jQuery.noConflict();

That means you should use jQuery instead of $. Something like this:

jQuery("#owl-demo");


来源:https://stackoverflow.com/questions/24129993/uncaught-typeerror-cannot-read-property-owlcarousel-of-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!