1

我想添加一些显示我网站统计信息的应用程序。piwik 给我的嵌入代码类似于

<div id="widgetIframe"><iframe width="100%" height="350" src="http://dap.ntua.gr/el/apps/piwik/index.php?module=Widgetize&action=iframe&moduleToWidgetize=Live&actionToWidgetize=widget&idSite=1&period=day&date=today&disableLink=1&widget=1" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>

问题是有时 iframe 的高度比 piwik 建议我嵌入的要大。其他时候高度较小。我该如何解决这个问题?height="auto"我没有运气写作

有什么建议吗?

编辑:请注意,我在 localhost 中尝试此操作,但 piwik(以及 iframe)已安装到我的真实站点中。

Edit2:这行代码解决了问题http://css-tricks.com/snippets/jquery/fit-iframe-to-content/

仍然存在问题:如果 iframe 内的内容改变高度,这将无法适应

4

0 回答 0