これまでの私のコード:
$(".lorem img:not(.full-img)").each(function() {
$(this).addClass("inline-img");
var imgWidth = $(this).prop('width');
var imgHeight = $(this).prop('height');
var imgFloat = $(this).prop('float');
$(this).wrap('<div class="inline-img-wrap" />');
if ($(this).prop("title")!='') {
$('<p class="inline-img-caption">').text($(this).prop('title')).insertAfter($(this));
}
});
テキストの本文内で画像を検索し、そのtitle値をキャプションとして下に追加し、との両方imgをpでラップしていdiv.inline-img-wrapます。それはうまくいきます。
私が助けを必要としているのは、img代わりに新しいラッピングdivにのスタイルを適用することです。これだけの変数を作成したことがわかりますが、それらを機能に適用することはできません。$this常に画像に適用され、<div class="inline-img-wrap" style="width:'+imgWidth+'">機能しません。
すべてのアドバイスに感謝します!