$(document).ready(function() {
$("img.resizeImage").each(function(){
var img = $(this);
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// alert("give image size ....."+width+", "+height);
var pic_real_width, pic_real_height;
$("<img/>").attr("src", $(img).attr("src"))
.load(function() {
pic_real_width = this.width;
pic_real_height = this.height;
});
if(pic_real_width < width ){
//alert("display original width.sssss 103..");
$(this).removeAttr("width");
$(this).css("width",pic_real_width);
}
if( pic_real_height < height ){
//alert("display original height ss.102..");
$(this).removeAttr("height");
$(this).css("height",pic_real_height);
}
});
});
上記のjquery実行フローでは、if条件が最後にヒットしません。望む結果が得られません。2 つの if() の上に何らかのアラートを保持すると、実行フローは 2 つの if 条件内に入ります。助けてください。jqueryステートメントを1行ずつ実行する方法..