使ったサイト。
なろう廃人のすすめ
元のheightをcssで100pxに設定、
そこからアニメーションでheightをautoにする。
autoにした場合の具体的なheightの数値をjqueryで取得、
その数値に向かってanimateさせることで
autoに向かってアニメーションで変更することを実装。
//現在のheight取得
curHeight = $(this).height();
//autoにした場合のheightを取得
autoHeight = $(this).css('height', 'auto').height();
//autoにした場合のheightへ向かってanimate
//数値なのでanimateが有効
$(this).height(curHeight).animate({height: autoHeight}, 150);
戻す場合は普通に数値指定すればOK。
$(this).animate({height: "100px"}, 150);