<div class="post">Height is 100px</div>
<div class="post">Height is 200px</div>
<div class="post">Height is 50%</div>
<div class="post">Height is 2em</div>
<div class="post">Height is auto</div>
var heights = [100, '200px', '50%', '2em', 'auto'];
$('.post').each(function(index) {
var value = heights[index];
this.style.height = +value ? value + 'px' : value;
});