jQuery 1.4 与 jquery ui 和 drupal 6 没有冲突
我正在实现一个小型调查提示器/提醒工具,该工具正在包含各种 ColdFusion 和静态 html 页面的 Drupal 6 网站环境中实现。我正在尝试将 jQuery 1.4.4 与 Drupal 的 1.2.6 版本一起使用。
我像这样导入 jQuery 1.4.4:
<code>
<script type="text/javascript" src="/misc/jquery.js?7"></script>
<script type="text/javascript" src="/misc/drupal.js?7"></script>
<script type="text/javascript" src="/sites/all/modules/lightbox2/js/lightbox.js?7"></script>
<script type="text/javascript" src="/sites/all/modules/poormanscron/poormanscron.js?7"></script>
<script type="text/javascript" src="/sites/all/themes/realdecoy/scripts/jquery.carousel.js?7"></script>
<script type="text/javascript" src="/sites/all/themes/realdecoy/scripts/jquery.superbox-min.js?7"></script>
<script type="text/javascript" src="/sites/all/themes/realdecoy/scripts/swfobject.js?7"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script>
<script type="text/javascript" src="/_inc/survey/jquery.cookie.js"></script>
<!-- this script starts with : var j144 = jQuery.noConflict() : which I believe should restore $ to the jQuery 1.2.6 instance -->
<!-- this then sets up numerous behaviors using the j144 instance -->
<script type="text/javascript" src="/_inc/survey/survey.js"></script>
</code>
现在用户将加载页面(并且当我没有 1.2.6 时确实会发生,即没有要处理的 noConflict),并被询问是否参与调查他们的访问结束了。随后,使用 cookie,对用户的行为进行某种程度的监控,以检测他们何时离开网站(即导航到页面或单击外部链接)。就像我说的,这一切都工作正常,并且当我处理 ColdFusion 脚本时,我已经对此进行了测试,并且不必使用 noConflict 来允许 Drupal 的 jQuery 共存。现在,在 noConflict 的情况下,它不会完全发生故障,但是整个过程有很多错误,并且无法一致地进行。
有人对如何找到问题所在有任何建议吗?我对加载 jQuery 1.4 后加载的一些插件进行了一些小的编辑,并且对代码进行了修改
I am implementing a little survey prompter / reminder tool that is being implemented in a Drupal 6 website environment that contains various ColdFusion and static html pages. I am attempting to use jQuery 1.4.4 with Drupal's version of 1.2.6.
I am importing jQuery 1.4.4 like this:
<code>
<script type="text/javascript" src="/misc/jquery.js?7"></script>
<script type="text/javascript" src="/misc/drupal.js?7"></script>
<script type="text/javascript" src="/sites/all/modules/lightbox2/js/lightbox.js?7"></script>
<script type="text/javascript" src="/sites/all/modules/poormanscron/poormanscron.js?7"></script>
<script type="text/javascript" src="/sites/all/themes/realdecoy/scripts/jquery.carousel.js?7"></script>
<script type="text/javascript" src="/sites/all/themes/realdecoy/scripts/jquery.superbox-min.js?7"></script>
<script type="text/javascript" src="/sites/all/themes/realdecoy/scripts/swfobject.js?7"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script>
<script type="text/javascript" src="/_inc/survey/jquery.cookie.js"></script>
<!-- this script starts with : var j144 = jQuery.noConflict() : which I believe should restore $ to the jQuery 1.2.6 instance -->
<!-- this then sets up numerous behaviors using the j144 instance -->
<script type="text/javascript" src="/_inc/survey/survey.js"></script>
</code>
Now what should (and does happen when I do not have 1.2.6 i.e., no noConflict to deal with) the user will load the page, and be asked about participating in a survey at the end of their visit. Subsequently using cookies the users behavior is somewhat monitored to detect when they leave the site (i.e., navigate to a page, or click an external link). Like I said, this all works correctly, and I have performed testing on this, when I am working on a ColdFusion script and do not have to use noConflict to allow Drupal's jQuery to co exist. Now, it does not malfunction completely with noConflict, however the entire process is very buggy and does not flow consistently.
Does anyone have any suggestions about how to go about finding where the problem is? I've made several small edits to some of the plugins being loaded after I load jQuery 1.4, and I've juggled the code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定不能直接升级 Drupal 的 1.2.6 版本吗?加载两个单独的 jquery 版本似乎也浪费了带宽/CPU/雨林。
到目前为止,jQuery 版本大多是向后兼容的。添加功能比删除功能更重要。
Are you sure you can't just upgrade Drupal's 1.2.6 version? It also seems like a waste of bandwidth/cpu/rainforests to be loading two separate jquery versions.
So far jQuery versions have mostly been backwards compatible. Adding features more than removing them.