我正在使用https://github.com/davidjbradshaw/iframe-resizer库,并按照其作者的建议,在这里问我的问题。
我有一个 Angular 应用程序加载到 iframe 中,这个应用程序有一些元素位于底部,带有“绝对”或“固定”。这意味着,帧收缩不能使用默认方法正常工作,我发现heightCalculationMethod: "taggedElement"
在我的情况下是最可靠的。但只有一个问题。我的页面正在使用带有动画状态更改的 ui-router,现在在动画期间,帧高度设置为 0,使动画不可见。所以我发现我需要使用minHeight
iframe-resizer 的选项。它通常工作正常,我通常将其设置为minHeight: window.innerHeight - 45
45 是 iframe 之外页面的高度。
但是我希望 iframe-resizer 在minHeight
每次调整大小时重新计算,因为用户可能已经调整了他的浏览器窗口的大小。
我想,如果 iframe-resizer 接受函数 for ,它会起作用minHeight
,所以我可以这样做:
minHeight: function(){ return window.innerHeight - 45; }
但我看到目前它只是addStyle('minHeight');
在初始设置期间执行,所以我的解决方案不起作用。
使 iframe-resizer 与动态 minHeight 一起使用的最佳方法是什么?