【发布时间】:2012-10-05 22:13:26
【问题描述】:
图像源拥有真实的图像尺寸(宽度/高度)。在有 5 张图片的div#pics 中,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 张图像?
【问题讨论】:
标签: jquery image filter dimensions image-size