开发者

Faking body.scrollHeight

I have a JavaScript application that is being loaded in an iframe (via a Liferay portlet). The actual HTML is just an empty tag and the JS is loaded when the document is loaded.

When Liferay loads the page in the iframe, it resizes the frame based on the body.scrollHeight property which ends up being 0 since there is no real content in the page before it is loaded.

Is there a way to to style or m开发者_如何学Codify the page in such a way that body.scrollHeight will give a reasonable value and not zero?

I've tried setting the body height to 100% and adding an   but that didn't work.


You could set a javascript event in <body onload="doStuff()"> which would then have the scrollheight poperly set when it's called.

Or set the CSS to a fixed pixel height like body { height: 250px }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜