jQuery設定div高度等高

如果要用div去製作以往表格的效果,可能會遇到左右沒辦法對稱的問題,這時候可以先抓取原本的高度,然後找去其中最大的值,之後再動態讓Dom去改變高度就可以了。

  1. height1=$(selector1).height();   
  2. height2=$(selector2).height();   
  3. maxHeight=Math.max(height1=, height12);   
  4. $(selector1, selector2).height(maxHeight);  

留言