imgタグをスパンでラップし、イメージをスパンの背景イメージにする機能を持つこのスニペットに出くわしました。私の質問は、特定の img タグまたは特定の div 内の一部の img タグにのみ適用するにはどうすればよいですか?
$(document).ready(function(){
$("img").load(function() {
$(this).wrap(function(){
return '<span class="image-wrap ' + $(this).attr('class') + '"
style="position:relative; display:inline-block; background:url(' + $(this).attr('src') + ') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;" />';
});
$(this).css("opacity","0");
});
});