var contentparanum = 1;
while($(".container").height() < 200){
paranum++;
$(".content").append("<p></p>");
$(".content p:nth-child("+contentparanum+")").load("getcontent.php?paranum="+paranum);
contentparanum++;
//use load() to add content into container, when the height of container is over 200px the loop stops
}
問題は、ループが止まらないことです。alert(".container"); を追加しました。ループに入ると、0しか取得できません。コンテナの高さは、whileループが終了した後にのみ取得できるようです。この問題を解決するにはどうすればよいですか?
特定のコードを追加しました
そしてhtmlコードはこちら
<div class="container">
<div class="content"></div>
</div>