我exteranlly加载图像通过像这样的AJAX加载的图像的高度和宽度...无法获得阿贾克斯 - 通过jQuery
function load_image(image_href) {
var img = new Image();
$(img).load(function() {
$(this).hide(); $('#a_box').append(this);
$(this).fadeIn();
}, gallery_image_load_complete()
).error(function() {
}).attr('src', image_href);
}
function gallery_image_load_complete() {
conslole.log('complete')
$('#a_box img').height(); //wrong numbers, as though the image is partially loaded
$('#a_box img').width(); //wrong numbers
}
问题是,我试图让加载的图像的高度和函数gallery_image_load_complete()中的宽度。 由于某些原因,此图像高度和宽度已关闭,这是因为图像尚未完全加载。
有人可以帮我吗?
负载方法的第一个参数应该是URL,这似乎缺少。可以解释这个问题。 – JohnFx 2010-04-21 22:09:23