细枝末节

SCRIPT:

var img = $('<img/>');

img.load(function() {
var height = $("#div_img img").height();
alert(height);
});
$("#div_img").empty();
$("#div_img").append(img);

img.attr("src", image_url);

HTML:

<div id="div_img" style="visibility: hidden; overflow: hidden; width: 0px; height: 0px;"></div>


1、jQuery,load函数

2、style="visibility: hidden; overflow: hidden; width: 0px; height: 0px;"

为何不用:display: none;

你可能感兴趣的:(细枝末节)