问题描述
我有一个页面正在使用Mootools 1.2.4和 MediaboxAdvanced 灯箱.由于特定的javascript错误,我似乎无法正常工作
I've got a page where I'm using Mootools 1.2.4 and MediaboxAdvanced as a lightbox. I can't seem to get the thing working because of a particular javascript error
在Mediabox初始化时:
at the initialization of Mediabox:
$(document.body).adopt(
$$([
overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close),
center = new Element("div", {id: "mbCenter"})
]).setStyle("display", "none")
);
该页面位于此处.如果您单击该人的名字,图片或右下角的更多信息"按钮,则应该启动Mediabox.通过Firebug,我已经确认正在加载CSS,正在加载mootools和正在加载Mediabox脚本;图像的所有路径以及所有内容都是正确的.
The page is here. If yo uclick on the guy's name, picture, or the More Info button on the bottom right, it is supposed to launch the Mediabox. Via Firebug, I have confirmed that the CSS is loading, mootools is loading, and the Mediabox script is loading; all the paths to images and everything are correct as well.
有什么想法吗?
推荐答案
您可能只能在$ getElementById返回的元素上使用$.一个简单的解决方法是改为使用$$.
You may only be able to use $ on an element returned from getElementById. A simple workaround is to instead use $$.
$$('body')[0].adopt...
这篇关于document.body为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!