i want to to get the height/width of an image inside a hidden div-containter, but .height()
and .width()
both returns 0 (like expected).
I'm not sure you can do it with jQuery (or javascript at all). I had a similar problem with misreported heights and widths on loading/hidden img
's. You can, however, wait till the image loads, get it's correct height and width and then hide the parent... like so:
var height, width;
$('#myimg').load(function() {
height = $(this).height();
width = $(this).width();
$('#init').hide();
}