gpt4 book ai didi

jquery - 将父 DIV 高度调整为内部内容(RSS 提要)

转载 作者:太空宇宙 更新时间:2023-11-04 12:00:15 25 4
gpt4 key购买 nike

我正在使用 Google Feed API 将 RSS 提要嵌入到我的 html 网站中。我尝试使用 jquery 使父 DIV 调整其高度:

function setHeightParent() {
$("#Parent").height($("#feed").height() + 200);
}

这会产生一个高度为 200 像素的父 DIV。我认为高度是在“feed”div 有任何内容之前计算的,因此没有高度..我做错了什么,我怎样才能让它占据最终“feed”div 的高度?

最佳答案

我知道了...

Amir 对延迟的看法是正确的。

这样解决的:

$(document).ready(function() {
function setHeightParent() {
$("#Parent").css("height", $("#feed").height() + 250);
}
setTimeout(setHeightParent, 800)
});

关于jquery - 将父 DIV 高度调整为内部内容(RSS 提要),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29868160/

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