一連のクリック可能なボックスがあります。ボックスを展開してその画像を非表示にできるようにする必要があります。また、前に開いたものを閉じて、元の高さと定義された幅に戻し、img でフェードバックできるようにする必要もあります。.info
ajax コンテンツを読み込む
<div class="box">
<img src="#" />
<div class="info"></div>
</div>
<div class="box">
<img src="#" />
<div class="info">Ajax load content</div>
</div>
<div class="box">
<img src="#" />
<div class="info">Ajax loads content</div>
</div>
css、高さがわかりません。
.box {
width: 230px;
height: auto;
}
.info {
height: auto;
width: auto;
}
私は試した
$(".box").each(function(){
var box = $(this);
box.data('height', $(this).height());
box.click(function(){
box.addClass("opened");
if(box.hasClass("opened"){
$("img", this).fadeOut("slow", function(){
box.css("width", "600");
box.css("height", "500");
box.removeClass("opened");
});
} else {
$("img", this).fadeIn("slow");
box.width(230);
box.height(box.data('height'));
});
});