<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Two instances of the map on a page]]></title><description><![CDATA[<p dir="auto">I am trying and intend to use the windy map both to appear inside a small widget, as well as appear (increased in size), in a big modal when the expand map button is clicked on the widget.</p>
<p dir="auto">That would require 2 instances of the map to exist on the page as the application is an SPA and all content is shown on the same page.</p>
<p dir="auto">I tried implementing the above and although it does seem to be working (both maps are fine), a lot of console errors seem to appear, due to several of the main object's properties <strong>W</strong> being reinitialized. e.g. <code>Object W.params already exists</code></p>
<p dir="auto">According to the <strong>Things to remember</strong> in the API Windy API v4 documentation:</p>
<p dir="auto"><em>There can be only one instance of Windy Map on a page, but you can use multiple instances of Leaflet map on the same page.</em></p>
<p dir="auto">Does the above mean that I cannot do what I have in mind? Is this a <strong>conditions of use limitation</strong> or a <strong>technical limitation</strong>?</p>
<p dir="auto">A few questions based on the above:</p>
<ol>
<li>
<p dir="auto">Are the console errors I'm getting normal behavior?</p>
</li>
<li>
<p dir="auto">Are they the reason why we shouldn't be using 2 instances of the map on the same page (due to the global <strong>W</strong> object being reinitialized?)</p>
</li>
<li>
<p dir="auto">Is there a workaround for this and would it be allowed and recommended?</p>
</li>
</ol>
]]></description><link>https://community.windy.com/topic/6920/two-instances-of-the-map-on-a-page</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 07:28:54 GMT</lastBuildDate><atom:link href="https://community.windy.com/topic/6920.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Oct 2018 10:22:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Two instances of the map on a page on Wed, 10 Oct 2018 10:39:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kostis90" aria-label="Profile: kostis90">@<bdi>kostis90</bdi></a><br />
I do this by resizing the DIV of Windy.<br />
(Toggle class between contentbg and map-large)</p>
<p dir="auto">JS:<br />
var mapexpandbool = 0;<br />
var mapdivmenu = document.getElementById("weather-map");<br />
var mapdivmenutext = document.getElementById("weather-map+-");<br />
var mapframe = document.getElementById("weather-map");<br />
function weathermapexpand() {<br />
if (mapexpandbool === 0) {<br />
mapdivmenu.className = 'map-large';<br />
mapdivmenutext.innerHTML = '-';<br />
mapexpandbool = 1;<br />
} else {<br />
mapframe.className = 'contentbg';<br />
mapdivmenutext.innerHTML = '+';<br />
mapexpandbool = 0;<br />
}<br />
}</p>
<p dir="auto">CSS:<br />
.contentbg {<br />
width: calc(100% - 10px - 2px);<br />
border-width: 1px;<br />
border-color: rgba(255, 255, 255, 0.5);<br />
border-style: solid;<br />
background-color: rgba(0, 0, 0, 0.15);<br />
opacity: 1;<br />
-webkit-backdrop-filter: blur(10px);<br />
backdrop-filter: blur(10px);<br />
display:inline-block;<br />
padding: 5px;<br />
margin-bottom: 15px;<br />
transition: .5s linear;<br />
-ms-transition: .5s linear;<br />
cursor: default;<br />
}<br />
.map-large {<br />
width: calc(90vw - 12px) !important;<br />
height: calc(90vh - 12px) !important;<br />
top: 0vh !important;<br />
display: block;<br />
position: absolute;<br />
z-index: 10;<br />
transition: .5s linear;<br />
-ms-transition: .5s linear;<br />
border-width: 1px;<br />
border-color: rgba(255, 255, 255, 0.5);<br />
border-style: solid;<br />
background-color: rgba(0, 0, 0, 1);<br />
padding: 5px;<br />
}</p>
]]></description><link>https://community.windy.com/post/15725</link><guid isPermaLink="true">https://community.windy.com/post/15725</guid><dc:creator><![CDATA[arjannv]]></dc:creator><pubDate>Wed, 10 Oct 2018 10:39:37 GMT</pubDate></item></channel></rss>