开发者

how to get image size in jQuery that img tag is created dynamically in between div tag? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

is there anyone pl开发者_运维知识库ease help me its argent............ :)


You can use pure Javascript for this:

var img = document.getElementById('imageInQuestion'); 
var width = img.clientWidth;
var height = img.clientHeight;

Edit: (via jQuery (Although untested) )

var imgWidth = $("#imageInQuestion").width();
var imgWidth = $("#imageInQuestion").height();

I am assuming that by size, you meant dimensions, please correct me if I'm wrong.


Try this

$('#imageId').clone().removeAttr("height").attr("height");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜