在div内容加载后得到div高度

The*_*tor 7 jquery height

我试图设置一个div等于另一个的高度.我会称他们为左右div.正确的div内容并不总是相同的,并加载了jQuery.它是一个过滤器,因此每次单击过滤器时,内容都会更改,也会更改父div高度.

这是我的代码:

jQuery(document).ready(function($) {
    $(window).resize(function() {
        location.reload();
    });
    var Height = $("#archive").outerHeight();
    $('.recursos-sidebar').css("height", Height);
});
Run Code Online (Sandbox Code Playgroud)

问题是,当div为空(没有加载内容)时,左div高度等于右div.

有人知道每次内容更改后如何才能获得正确div的高度?

Zac*_*cer 0

我不想搜索你网站上的源代码,所以这里是我认为你正在谈论的内容的一个裂缝。

<div id="firstdiv"></div>
<div id="seconddiv"></div>

<script>
    $("firstdiv").change(function () {
        var s= $("seconddiv").height();
        $(this).height(sndHeight);
    });
</script>
Run Code Online (Sandbox Code Playgroud)