我一直想知道为什么浮动框插件无法在我的页面右下角放置一个 div 容器。 http://www.phpletter.com/Demo/Jquery-Floating-Box-Plugin/ 今天我用firebug检查了我的网站,发现了这个错误:
$("#thediv").floating 不是函数
在线:$("#thediv").floating({targetX:"right", targetY:"bottom"});
这是代码:
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.floatingbox.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(
function(){
jQuery("#thediv").floating({targetX:"right", targetY:"bottom"});
}
);
</script>
浮动函数在插件中是这样创建的:
jQuery.fn.floating = function(options)
{
return jQuery(this).each(
function(i)
{
var nextIndex = 0;
for(var index in funcFloating)
{
nextIndex = parseInt(index);
}
funcFloating[nextIndex + 1] = {};
funcFloating[nextIndex + 1].box = this;
funcFloating[nextIndex + 1].obj = new floatingBox(this, options, (nextIndex + 1));
funcFloating[nextIndex + 1].func = function(){ funcFloating[nextIndex + 1].obj.doFloat(); };
if (document.layers)
{
funcFloating[nextIndex + 1].obj.init();
}else
{
funcFloating[nextIndex + 1].obj.init();
funcFloating[nextIndex + 1].obj.initSecondary();
}
}
);
};
我能做些什么来解决这个问题?查看插件示例页面上的源代码时,我看到使用与我自己的页面上相同的代码。
如果这是某种冲突错误,第一次使用“$”(在“$(document)”中)不会触发错误吗?