图像源拥有真实的图像尺寸(宽度/高度)。在一个div#pics
有 5 个图像的图像中,3 个图像是 16X16,2 个图像是 2x2。两个 2x2 图像都有一个应用到它们的类,使它们成为 16x16,其他 3 个图像是 16x16。问题是,当我以这种方式过滤时:
var Images = $('#pics img');
var FilteredImages = Images.filter(function(){
return ($(this).width() == 16) || ($(this).height() == 16)
});
FilteredImages
包含所有 5 个图像,因为它考虑了使 2 个 2x2 图像为 16x16 的类。如何FilteredImages
只保存其源图像大小(不是 css)为 16x16 的 3 个图像?