I have a structure like this. A container with 5 cards (5 elements, each with a header, content and footer). Header, footer and content have static heights but the card itself has dynamic one (because content can dynamically grow). Im trying to add animations using css3 and I need to get the height of the cards when content it´s appended to them.
This is the part of the code where the content gets appended to the card
function card_constructor(data) {
$card = $(cards_template(data)); //pass data to template
card_id = data.id;
$contentJQuery = $card.find('.content');
content = data.options;
template = data.template;
is_visible = true;
if(content.length === 0) is_visible = false; //if no content available, do not show card
//loop through content array in order to append its data to the card
for (var d=0; d<content.length; d++) {
$contentJQuery.append(template(content[d]));
}
console.log($card.height()); // here is where 0 is returned
//also tried console.log($card) and that returns the card with all its //content
}
I dont know why this happens.. When I try to get the height directly from the console on Chrome, it works