jQuery与sfwObject冲突 [英] jQuery conflict with sfwObject
问题描述
我正在使用jQuery创建选项卡 (www.jqueryui.com/tabs/).我使用jQuery v1.6.4
I am using jQuery to create Tabs (www.jqueryui.com/tabs/). I use jQuery v1.6.4
在同一页面中,有一个用于上传文件的sfwobject,它需要Adobe Flash Player.问题是它与jQuery冲突.我尝试了一些noConflict方法,但没有找到解决方法.
In the same page there is a sfwobject for uploading files and it requires adobe flash player. The problem is that it conflicts with jQuery. I tried some noConflict methods, but didnt found a solution.
<script type="text/javascript">
var _cssjQ = jQuery.noConflict();
_ccsjQ(function() {
_ccsjQ( "#tabs" ).tabs();
});
</script>
这里有两个与sfwobject有关的文件.
Here are two files that have to do with the sfwobject.
http://www.thegamelounge.net/public/js/3rd_party/swfupload/swfupload.js http://www.thegamelounge.net/public/js/3rd_party/swfupload/swfupload.sfw
谢谢!
推荐答案
jQuery不会删除$别名,如果您打算使用$别名,则需要使用以下形式:
jQuery no conflict removes the $ alias, you will need to use this form if you plan to use the $ alias:
(function($) {
$(function() {
// code using $ as alias to jQuery
$( "#tabs" ).tabs();
});
/// other stuff that uses the $ alias can go here
$(document).ready(function(){
// other code
$(document).click(function(){
alert("howdy");
});
});
})(jQuery);
该ips.attach.js
使用$别名,您将需要将其包装在无冲突的情况下,如上例所示,将$传递回去-请格外小心,因为这可能会从全局名称空间中删除其中的函数也.
That ips.attach.js
uses the $ alias, you will need to wrap it in a no-conflict that passes the $ back in such as the example above - use care as this will potentially remove the functions inside there from the global namespace also.
这篇关于jQuery与sfwObject冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!