How do I get the new dimensions of an element *after* it resizes due to a screen orientation change?
问题 I'm working on a mobile web app, and in my page I have a div element with its width set to 100%. I need to set the height of this div so that the height is correct for a set aspect ratio. So for example, if the screen was sized to 300 pixels wide and the ratio was 3:2, my script should grab the width of the div (which at this point should be 300px) and set the height to 200px. On first load, this works perfectly. However, if I rotate the screen of my phone to landscape, the width of the div