gpt4 book ai didi

jquery - 重新计算高度函数偶尔工作

转载 作者:行者123 更新时间:2023-11-28 13:16:30 25 4
gpt4 key购买 nike

我在读取 div 的高度然后调整另一个 div 的大小时遇到​​了一些问题。

基本上它只是偶尔做一次。

在我看来,该函数是在实际加载所有元素之前获取 div 的高度。

function recalculate_h() {
if ($(".content_full").is(":visible")){
var cur = $(".content_full").height()+100;
animate_height(cur);

}
}

function smooth_change(way) {
// rest of the code
$("#here").load("index.php?siteno="+next+" #there", function(evt) {

$("#outer").attr("siteno", next);
recalculate_h();
});
}

并且在document.ready中被调用

$(".left_navigator").click(function() {
smooth_change("back");
});

有什么想法我可能做错了吗?

附言

有两种导航站点的方法,通过基本的刷新和 GET 属性,以及使用 ajax 请求更流畅。另外,像这样在每次加载页面时都会调用 recalculate_h,而且效果很好。

$(window).load(function() {

recalculate_h();
//$('#map_canvas').gmap();

});

最佳答案

我之前在我的一个元素中做过同样的场景,我解决它的方法是捕获你想要调整大小的元素并将其 css 设置为 height: auto。然后添加其余代码。让我知道它是否有效。

关于jquery - 重新计算高度函数偶尔工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14982606/

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