【发布时间】:2009-12-09 11:53:23
【问题描述】:
我创建了一个if 函数来检查宽度是否小于 100 像素。由于某种原因,它隐藏了一切。有人知道为什么吗?
$(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.removeAttr("width");
$this.removeAttr("height");
var pic_real_width = $this.width();
var pic_real_height = $this.height();
if(pic_real_width<100){
$(this).css("display","none");
}
});
});
【问题讨论】:
标签: javascript jquery css image