I'm trying to get the height of an element with jQuery, but for some reason it always returns 0
.
I load content using ajax in a container. This content is hidden by default (display: none
). Before showing the content I need to retrieve the height of an element in the new content.
Which should work.
My simplified code:
success: function(data) // this is the success callback of jquery's ajax call
{
var content = $('#content');
content.fadeOut('slow', function() {
content.html(data.html);
set_comments_height();
content.fadeIn('slow');
});
}
function set_comments_height()
{
var content = $('#content');
var info = $('.trackinfo .artwork-and-info', content);
console.log(parseInt(info.outerHeight(true), 10));
}
You can see the issue on my website after clicking a track at the left side.
I might be missing something here, but I don't see why it doesn't return the correct height.