ich habe:Höhe und Breite des angehängten Bildes suchen?
for(var i=1;i<10;i++){
$('#vid_c_'+i).append('<div class="move_2" id="vd'+i+'"></div>');
$('#vd'+i).append('<img class="class" id="id_'+i+'" src="'+_m[i-1]+'">');
$("#id_"+i).load(function() {
var mv_pstimg = document.getElementById('id_'+i);
var width = mv_pstimg.clientWidth;
var height = mv_pstimg.clientHeight;
console.log(height +" "+width);
});
}
Konsolausgaben: Uncaught TypeError: Cannot read property 'clientWidth' of null
FYI: Das Bild wird in meinem Browser fein geladen
Ich habe auch versucht
$("img").one("load", function() {
var mv_pstimg = document.getElementById('id_'+i);
var width = mv_pstimg.clientWidth;
var height = mv_pstimg.clientHeight;
console.log(height +" "+width);
}).each(function() {
if(this.complete) $(this).load();
});
Gleiches Ergebnis