I have a script that calculates the height of a div and returns it as a style. But when you rotate mobile-devices the height changes, so I need a way to reload it. How can I accomplish this?
<script type="text/javascript">
window.onload = function() {
var height = document.getElementById('id').offsetHeight;
document.getElementById('id').style.marginTop = height + 'px';
}
</script>