Added support to totalHeight for hidden elements