gpt4 book ai didi

amp-html - 创建AMP iframe如何根据内容调整高度

转载 作者:行者123 更新时间:2023-12-05 06:29:59 24 4
gpt4 key购买 nike

有没有办法确保 AMP iframe 根据内部内容调整其高度?此内容是动态的,可能会不时更改。谢谢

最佳答案

您可以使用 amp-iframe resizing API 触发 amp-iframe 元素在嵌入文档中调整大小:

window.parent.postMessage({
sentinel: 'amp',
type: 'embed-size',
height: document.body.scrollHeight
}, '*');

Here is a sample implementation with documentation .

关于amp-html - 创建AMP iframe如何根据内容调整高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52872422/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com