jQuery与其他库冲突 [英] jQuery conflicting with other libraries

查看:96
本文介绍了jQuery与其他库冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jQuery实现中遇到麻烦, 我的jQuery代码与此发生冲突. 我正在将'latest.pack.js'与'source.js'和'prototype.js'一起使用.

I am facing trouble in jQuery implementation, my jQuery code have been conflicted in this. I am using 'latest.pack.js' with 'source.js' and 'prototype.js'.

上面提到所有jQuery无法正常工作的原因可能是相冲突的,而jQuery彼此没有冲突的代码也不能在那里工作. 因此,请尽快帮助我

Above mentioned all jQuery not working reason may be conflicting and jQuery no conflicting code is also not working there . So Please help me soon as possible

链接是: http://prototypejs.org/assets/2009/8/31/prototype.js

推荐答案

如果有可能,请帮自己一个忙,并仅使用一个JavaScript库.

If at all possible, do yourself the favour and use one JavaScript library only.

  • 加载两个功能强大的库可能会占用大量资源,尤其是当它们都遍历整个DOM来初始化一些小部件或某些东西时,尤其如此.

  • Loading two full-blown libraries can be resource-heavy, especially if they both walk through the entire DOM to initialize some widgets or something.

即使使用noConflict,也可能出现问题.库使用不同的内部方法来操纵事件和DOM节点. noConflict可能无法阻止一些细微的错误.

Even with noConflict it is possible for problems to occur. Libraries use different internal methods to manipulate events and DOM nodes. There is the possibility of subtle bugs that noConflict is unable to prevent.

您将使用两种语法和哲学.

You will have two syntaxes and philosophies to work with.

您将有两个库来更新和检查依赖关系.

You will have two libraries to update and check dependencies for.

选择一个,然后基于该库选择您的插件和小部件.

Pick one, and select your plugins and widgets based on that one library.

这篇关于jQuery与其他库冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆