未捕获到的typeError:无法读取null的属性'owlCarousel' [英] Uncaught typeError: Cannot read property 'owlCarousel' of null
问题描述
我遇到了一个jQuery Issue,请理解我不是jQuery专家,所以请多多包涵.我正在尝试在magento上安装此猫头鹰响应式"滑块,而此"
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 "
未捕获的typeError:无法在Chrome控制台中读取null的属性"owlCarousel"
Uncaught typeError: Cannot read property 'owlCarousel' of null in Chrome console
谢谢.
推荐答案
默认情况下,Magento使用prototypejs
框架,该框架使用$
作为全局变量.如果您包括其他也使用$
作为全局变量的jQuery之类的JavaScript插件,则与prototypejs和jquery相关的变量将发生冲突.可以通过为jquery插件的全局变量分配不同的名称来解决此冲突.
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.
要这样做,请在计划使用jQuery而不是原型的所有文件中使用以下代码.
To do that, use the following code above in all files wherever you are planning to use jQuery instead of prototype.
jQuery.noConflict();
这意味着您应该使用jQuery
而不是$
.像这样:
That means you should use jQuery
instead of $
. Something like this:
jQuery("#owl-demo");
这篇关于未捕获到的typeError:无法读取null的属性'owlCarousel'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!