mootools 和另一个(非框架)脚本之间的冲突
我正在尝试将名为 ImageFlow 的 javascript 集成到 Joomla 网站中,但出现错误Internet Explorer(v8 本机和兼容模式)并且不会显示。 它在 Firefox 和其他浏览器中运行良好)。
我认为该错误与 mootools 有关。 错误详情:
消息:对象不支持此属性或方法
线路:48
字符:27
代码:0
URI:[域]/media/system/js/mootools.js消息:对象不支持此属性或方法
线路:953
字符:4
代码:0
URI:[域]/media/imageflow/imageflow.js
mootools 第 48 行(缩小)的开头是:
if(!this.addEventListener)fn=fn.create({'bind':this,'event':true});
相关的 imageflow 代码是:
/* Just in case window.onload happens first, add it to onload
using an available method.*/
if(typeof addEvent !== "undefined")
{
addEvent(window, "load", run); // <-- line 953
}
else if(document.addEventListener)
{
document.addEventListener("load", run, false);
}
else if(typeof window.onload === "function")
{
var oldonload = window.onload;
window.onload = function()
{
domReadyEvent.run();
oldonload();
};
}
else
{
window.onload = run;
}
I'm trying to integrate a javascript called ImageFlow into a Joomla site, but I'm getting an error in Internet Explorer (v8 native and compatibility mode) and it won't display. It works fine in Firefox and other browsers).
I believe the error is related to mootools. Error details:
Message: Object doesn't support this property or method
Line: 48
Char: 27
Code: 0
URI: [domain]/media/system/js/mootools.jsMessage: Object doesn't support this property or method
Line: 953
Char: 4
Code: 0
URI: [domain]/media/imageflow/imageflow.js
The beginning of mootools line 48 (minified) is:
if(!this.addEventListener)fn=fn.create({'bind':this,'event':true});
The relevant imageflow code is:
/* Just in case window.onload happens first, add it to onload
using an available method.*/
if(typeof addEvent !== "undefined")
{
addEvent(window, "load", run); // <-- line 953
}
else if(document.addEventListener)
{
document.addEventListener("load", run, false);
}
else if(typeof window.onload === "function")
{
var oldonload = window.onload;
window.onload = function()
{
domReadyEvent.run();
oldonload();
};
}
else
{
window.onload = run;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了一个解决方案:从图像流代码中删除第一个 if 子句。 我不知道它是否适用于旧版浏览器,但如果没有它,脚本在 IE 6-8 和适当的浏览器中工作得很好。
I found a solution: remove the first if-clause from the imageflow code. I don't know if it was there for legacy browsers perhaps, but without it the script works perfectly fine in IE 6-8 and the proper browsers.
我曾经在使用 lightbox 和 mootools 时遇到过类似的问题。 我通过找到一个基于 mootools 的灯箱实现解决了这个问题(实际上更好)。 如果不能,那么我建议将 ImageFlow 放入 iframe 中,这样两个脚本就不会冲突。
I had a similar problem once with lightbox and mootools. I solved it by finding a lightbox implementation based on mootools (which was actually better). If you can't, then I suggest putting the ImageFlow into an iframe, so the two scripts won't conflict.