私は現在、このコードを持っています:
$('.blogimages img').css('marginLeft', function() {
return - $(this).width()/2;
});
ただしwidth="750"
、スタイルシートで新しく計算された属性の代わりに属性を取得しています。
画像設定例:
<div class="img-wrap" style="position: relative; ">
<img class="insert-all wide" title="23" src="http://www.threefishfiesta.com/wp-content/uploads/2012/08/231.jpeg" alt="" width="750" height="500">
</div>
CSS:
.client-small .img-wrap {
width: 200px;
height: 200px;
overflow: hidden;
text-align: center;
}
.img-wrap .wide{
height: 100%;
width: auto;
}
.img-wrap .tall{
width: 100%;
height: auto;
}
これを書き直して、html 属性の幅の代わりに CSS で生成された幅を取る方法はありますか?
ありがとう!