map.resize() odd behavior

Discussion created by knisleyj on Apr 26, 2012
I just wanted to share this with others who may be developing for mobile devices.  I have an application that uses jQuery Mobile, and I have a dialog window that opens to allow the user to switch between layers.  When this happens the map div is hidden automatically through the inner workings of jQuery (specifically, the parent div with data-role="page" is hidden by changing the css display value to "none").  If the user then rotates the screen an event is triggered which calls map.resize().  At the end of that call, if the map div (or its parent) is hidden while this happens, the map extent gets messed up.  Specifically, xmax and xmin are both set to the previous xmin value, and ymax and ymin are both set to the previous ymax value.  Once the dialog is closed the map is blank and the zoom buttons disappear.  Rotating the screen again calls another map.resize() and this time all extent values are NaN.

Long story short, don't try to call map.resize() if a jQuery dialog is open or if any other interaction has caused the map div to temporarily be hidden.