Collapse element height inside popup

Just had the exact same problem a couple of weeks ago. Check out this post with the answer: