jQuery.noConflict()破坏插件 [英] jQuery.noConflict() breaks plugin

查看:87
本文介绍了jQuery.noConflict()破坏插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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屋!

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