Expand/Collapse elements

This wix video tutorial shows the code in action. The problem is the big space between the footer and the object when the item is still collapsed. I followed the code exactly as they did it, but this issue was not addressed. Does anyone know how to eliminate this space/have a dynamic footer that adjusts with the expanding and collapsing elements?