<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Map disappears when size changes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594716#M55708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;My JS app (v3.6) has two parts: map and form.&amp;nbsp; Both are in absolutely positioned divs that toggle display.&amp;nbsp; In other words, when the map is visible, the form is set to display = none and when the form is set to display = block, the map is set to display = none.&lt;BR /&gt;&lt;BR /&gt;I am finding that if I go to the form page and move my browser from one monitor to another or even change the size of my browser window, when I return to the map page the map is not visible.&amp;nbsp; If I resize the map after returning to the map page, I only see a strip of map vertically in the center of the page and I get 2 error messages in my console that say:&lt;BR /&gt;&lt;BR /&gt;Error: Invalid value for &amp;lt;image&amp;gt; attribute x="NaN" svg.js:15&lt;BR /&gt;Error: Invalid value for &amp;lt;image&amp;gt; attribute y="NaN" svg.js:15&lt;BR /&gt;&lt;BR /&gt;How can I refresh the map so that it will show up even if the window size is changed while it is hidden.&amp;nbsp; As far as I can tell, everything works fine if I change the window size while the map is visible.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set autoResize to false&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var map = new Map("mapPane", { &amp;nbsp;&amp;nbsp; autoResize : false, //.....&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Handle the map resize only when the map is visible:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;on(window, 'resize', function() {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // prevent map from resizing when not visible. This would error otherwise &amp;nbsp;&amp;nbsp; if ( map is visible ) //pseudo code &amp;nbsp;&amp;nbsp; {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; map.resize(); &amp;nbsp;&amp;nbsp;&amp;nbsp; map.reposition(); &amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also after your map becomes visible, call resize() and reposition()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Sep 2013 15:11:35 GMT</pubDate>
    <dc:creator>MatthewLofgren</dc:creator>
    <dc:date>2013-09-10T15:11:35Z</dc:date>
    <item>
      <title>Map disappears when size changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594715#M55707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My JS app (v3.6) has two parts: map and form.&amp;nbsp; Both are in absolutely positioned divs that toggle display.&amp;nbsp; In other words, when the map is visible, the form is set to display = none and when the form is set to display = block, the map is set to display = none.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am finding that if I go to the form page and move my browser from one monitor to another or even change the size of my browser window, when I return to the map page the map is not visible.&amp;nbsp; If I resize the map after returning to the map page, I only see a strip of map vertically in the center of the page and I get 2 error messages in my console that say:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error: Invalid value for &amp;lt;image&amp;gt; attribute x="NaN" svg.js:15&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Error: Invalid value for &amp;lt;image&amp;gt; attribute y="NaN" svg.js:15&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I refresh the map so that it will show up even if the window size is changed while it is hidden.&amp;nbsp; As far as I can tell, everything works fine if I change the window size while the map is visible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 15:02:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594715#M55707</guid>
      <dc:creator>BrianBeck</dc:creator>
      <dc:date>2013-09-10T15:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Map disappears when size changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594716#M55708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;My JS app (v3.6) has two parts: map and form.&amp;nbsp; Both are in absolutely positioned divs that toggle display.&amp;nbsp; In other words, when the map is visible, the form is set to display = none and when the form is set to display = block, the map is set to display = none.&lt;BR /&gt;&lt;BR /&gt;I am finding that if I go to the form page and move my browser from one monitor to another or even change the size of my browser window, when I return to the map page the map is not visible.&amp;nbsp; If I resize the map after returning to the map page, I only see a strip of map vertically in the center of the page and I get 2 error messages in my console that say:&lt;BR /&gt;&lt;BR /&gt;Error: Invalid value for &amp;lt;image&amp;gt; attribute x="NaN" svg.js:15&lt;BR /&gt;Error: Invalid value for &amp;lt;image&amp;gt; attribute y="NaN" svg.js:15&lt;BR /&gt;&lt;BR /&gt;How can I refresh the map so that it will show up even if the window size is changed while it is hidden.&amp;nbsp; As far as I can tell, everything works fine if I change the window size while the map is visible.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set autoResize to false&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var map = new Map("mapPane", { &amp;nbsp;&amp;nbsp; autoResize : false, //.....&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Handle the map resize only when the map is visible:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;on(window, 'resize', function() {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // prevent map from resizing when not visible. This would error otherwise &amp;nbsp;&amp;nbsp; if ( map is visible ) //pseudo code &amp;nbsp;&amp;nbsp; {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; map.resize(); &amp;nbsp;&amp;nbsp;&amp;nbsp; map.reposition(); &amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also after your map becomes visible, call resize() and reposition()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 15:11:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594716#M55708</guid>
      <dc:creator>MatthewLofgren</dc:creator>
      <dc:date>2013-09-10T15:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Map disappears when size changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594717#M55709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Matt, that worked perfectly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 15:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/594717#M55709</guid>
      <dc:creator>BrianBeck</dc:creator>
      <dc:date>2013-09-10T15:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Map disappears when size changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/1202325#M78268</link>
      <description>&lt;P&gt;You save my life bro!&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 11:15:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-disappears-when-size-changes/m-p/1202325#M78268</guid>
      <dc:creator>RanaRameez</dc:creator>
      <dc:date>2022-08-12T11:15:23Z</dc:date>
    </item>
  </channel>
</rss>

