Jquery 在google chrome中获取图像大小未定义

Jquery 在google chrome中获取图像大小未定义,jquery,html,google-chrome,getimagesize,Jquery,Html,Google Chrome,Getimagesize,我的html中有几个图像标签和div,如下所示。 我的要求是计算每个图像的高度*宽度,如果高度*宽度没有这样的方法,请执行以下操作。这个内部加载函数不是jQuery对象,而是JavaScript HtmleElement。 使用: 使用$(this).width、$(this).height $('试试这个: $('img.captify').each(function(i,img){ img.onload = function() { if ((this.width

我的html中有几个图像标签和div,如下所示。

我的要求是计算每个图像的高度*宽度,如果高度*宽度没有这样的方法,请执行以下操作。这个内部加载函数不是jQuery对象,而是JavaScript HtmleElement。 使用:

使用$(this).width、$(this).height

$('试试这个:

$('img.captify').each(function(i,img){
    img.onload = function() {
        if ((this.width * this.height) < 5000) {
            $('#' + $(this).attr('rel')).remove();
            $(this).removeClass('captify');
        }
    }
});​
$('img.captify')。每个(函数(i,img){
img.onload=函数(){
如果((此宽度*此高度)<5000){
$('#'+$(this.attr('rel')).remove();
$(this.removeClass('captify');
}
}
});​
.....
picRealWidth = $(this).width( ); // return integer value
picRealHeight =  $(this)..height( );  // return integer value
.....
$('<img/>').attr('src', src)
.load(function(){
picRealWidth =$(this).width();
picRealHeight = $(this).height();
.......
$('img.captify').each(function(i,img){
    img.onload = function() {
        if ((this.width * this.height) < 5000) {
            $('#' + $(this).attr('rel')).remove();
            $(this).removeClass('captify');
        }
    }
});​