Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing a Google Map in a modal created with Twitter Bootstrap
    primarykey
    data
    text
    <p>I'm trying to insert a Google map into a modal using Twitter Bootstrap. The modal shows up with the shape of the map present, but only part of the map is displayed, the rest is gray. Upon resizing the screen the map always shows up correctly, although centered in the wrong place.</p> <p>I've searched and found suggestions such as calling the map's resize event, or setting the max-width of the map image to none, but none of these suggestions have helped so far. It seems like the map is failing to figure out it's correct size as long as it's in an element that's hidden. </p> <h2>JS</h2> <pre class="lang-js prettyprint-override"><code>function initialize() { var mapOptions = { center: new google.maps.LatLng(51.219987, 4.396237), zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("mapCanvas"), mapOptions); var marker = new google.maps.Marker({ position: new google.maps.LatLng(51.219987, 4.396237) }); marker.setMap(map); } </code></pre> <h2>HTML</h2> <pre class="lang-html prettyprint-override"><code>&lt;div class="modal hide fade" id="myModal"&gt; &lt;div class="modal-header"&gt; &lt;button type="button" class="close" data-dismiss="modal"&gt;×&lt;/button&gt; &lt;h3&gt;&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;div id="mapCanvas" style="width: 500px; height: 400px"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;a href="#" class="btn" data-dismiss="modal"&gt;Close&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I'm using Twitter Bootstrap v2.0.4. I need some help because I'm failing to trigger the resize event correctly or editing the css so that the Google map is left alone.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload