为什么ColorBox无法正常加载? [英] Why is ColorBox not loading properly?
问题描述
我得到的错误是:
$未定义
第8行
$ is undefined Line 8
:
$.colorbox({html:'<p>TEST TEST</p>'});
这是页面呈现的方式:
<script type="text/javascript" src="/sites/all/modules/jquery_update/replace/jquery.min.js?Y"></script>
<script type="text/javascript" src="/misc/drupal.js?Y"></script>
<script type="text/javascript" src="/sites/all/modules/fivestar/js/fivestar.js?Y"></script>
<script type="text/javascript" src="/sites/all/modules/extlink/extlink.js?Y"></script>
<script type="text/javascript" src="/sites/all/modules/signwriter/signwriter.js?Y"></script>
<script type="text/javascript" src="/sites/all/modules/thickbox/thickbox.js?Y"></script>
<script type="text/javascript" src="/sites/all/modules/ubercart/uc_roles/uc_roles.js?Y"></script>
<script type="text/javascript" defer="defer" src="/sites/all/modules/admin_menu/admin_menu.js?Y"></script>
<script type="text/javascript" src="/sites/all/libraries/jquery/colorbox/jquery.colorbox.js?Y"></script>
<script type="text/javascript" src="/sites/all/modules/mysite/mysite_module/js/sasapp.js?Y"></script<--($.colorbox({html:'<p>TEST</p>'});)
推荐答案
jQuery有一个功能,允许jQuery库与使用 $
作为函数名的任何其他库兼容;如果一个脚本导致jQuery以兼容的方式运行,那么函数 $
没有从jQuery定义,你只能使用 jQuery( )
以访问任何jQuery功能。
jQuery has a function that allows the jQuery library to be compatible with any other libraries that use $
as function name; if one of the script is causing jQuery to run in compatible way, then the function $
is not defined from jQuery, and you can only use jQuery()
to access any jQuery functionality.
如果 sites / all / modules / jquery_update / replace / jquery中的代码.min.js
没有损坏,这不是浏览器造成的问题,那就是我想到的唯一可能。
If the code in sites/all/modules/jquery_update/replace/jquery.min.js
is not corrupted, and it's not a problem caused from the browser, then that is the only possibility I can think of.
为了确定这不是另一个问题,我将使用一个非最小化的jQuery库。我有一些最小的jQuery库的问题,有些浏览器(主要是Internet Explorer 6,但是问题可能存在于不同的浏览器中)。
To be sure it's not another problem, I would use a non minimized version of the jQuery library. I had some problems with a minimized jQuery library, with some browsers (mainly Internet Explorer 6, but the issue could be present in different browsers).
这篇关于为什么ColorBox无法正常加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!