You need to bind your code on the window.onresize event :
window.onresize=function(){
$('div').height($('div').width());
};
Pergunta
The code to make a div height equal to its width below:
$('div').height($('div').width());
However if you manually resize the browser window the height will not update - you need to refresh the page. Any idea how to correct it?
Solução
You need to bind your code on the window.onresize event :
window.onresize=function(){
$('div').height($('div').width());
};