0
$(document).ready(function() {
var pic = $(".pic");
// need to remove these in of case img-element has set width and height
$(".pic").each(function() {
var $this = $(this);
$this.css({width: 'auto', height: 'auto'});
var pic_real_width = $this.width();
var pic_real_height = $this.height();
if(pic_real_width<100){
$(".pic").css("display","none");
}
});
});
我需要此检查.pic类的所有图像(它已经这样做)的高度,然后添加一个display:none给那些有一定大小的人。 (例如,如果一个img已根据100像素宽度它不应该被显示)JQuery高度条件
没有你5分钟前问同样的问题? http://stackoverflow.com/questions/1873419/jquery-get-height-width – marcgg 2009-12-09 12:16:49
它非常相似,这是指的代码。 – Carvefx 2009-12-09 12:22:41