I need to calculate a top position for an element of variable height, so I was thinking of doing the following:
- Move the element 1000px off the top of the viewport
- Set the element to display: block
- Get the height of the element
- Set the element to display: none
- Continue on as if everything is normal and good
Does anyone see any pitfalls in this approach? Is there a more elegant solution I'm missing? Thanks!