2011-10-26 14 views
3

クリックするとthatsはdivにslideDown()をトリガーします。私の考えは、divが拡張された後に、私は拡張divに基づいて別のdivの高さを設定することです。問題は、他のdivが完全に滑り落ちる前に高さを設定して設定することになります。実際には、divを滑らせる前にdivの高さが必要です。slidedown()の後の要素の高さを設定

slideDown()が完了するまですべてを一時停止する方法はありますか?

$div.slideDown(); 

//sets the height of the Container 
$outer_container.css("height", $inner_container.outerHeight()); 

答えて

3

アニメーションが完了した後にのみ実行さcallback functionを使用します。

$div.slideDown(400, function() { 
    //sets the height of the Container 
    $outer_container.css("height", $inner_container.outerHeight()); 
}); 

それとも、もう少しコンパクトapprachを使用する:

$div.slideDown(400, function() { 
    $outer_container.height($inner_container.outerHeight()); 
}); 
関連する問題