jQuery.noConflict()破坏插件 [英] jQuery.noConflict() breaks plugin
问题描述
我在Rails应用程序中同时使用了Prototype和jQuery.要解决$
冲突,请执行以下操作:
I use both Prototype and jQuery in my rails app. To resolve the $
conflict I do the following:
<script type="text/javascript">
var $j = jQuery.noConflict();
</script>
这通常效果很好,但是我试图使用一个插件,它不喜欢它并抛出
This works mostly fine, but I am trying to use a plugin that does not like it and throws a $ is not a function type
error.
该如何解决?
推荐答案
嗯. simpleslide的某些功能使用jquery包装技术来保护$的内部使用,而其他功能则没有.
Uhg. Some functions for simpleslide use a jquery wrapping technique to protect its internal use of $ and other functions do not.
只有几个顶级功能存在暴露问题(据我所知),因此您可以自己添加保护性包装和/或要求作者提供解决方法.
It's only a couple of top level functions with the exposure problem (as near as I can tell), so you could add the protective wrappers yourself and/or ask the author for a fix.
这篇关于jQuery.noConflict()破坏插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!