I'm having a weird problem while calculating the height of an element. It will be at height 0 in the beginning, animating it to its original height. If I remove the setTimeout, I always get 0 as the height (even when using plain javascript).
var $element = $(element);
$element.addClass("accessibleHidden"); //Position absolute off the screen
//Wait for the element to reflow, or you'll get zero-height
setTimeout(function() {
var height = $element.height();
$element.removeClass("accessibleHidden").addClass("collapsed").transit({ height: height }, 2000, "easeOutBack");
}, 0);
Is there any way around this?