javascript - Google Maps - 2 maps on the same page not working -
i need have 2 google maps on same page.
however, reason, first map seems displayed.
i've tried this topic without success, problem persists.
my code looks this
function initialize() { var mylatlng = new google.maps.latlng(41.560655,-8.386545); var mylatlng2 = new google.maps.latlng(41.560655,-8.386545); var mapoptions = { zoom: 5, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } var mapoptions2 = { zoom: 8, center: mylatlng2, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var map2 = new google.maps.map(document.getelementbyid('room-canvas'), mapoptions2); }
and html
<div class="g_12"> <div class="widget_header"> <h4 class="widget_header_title wwicon i_16_valid">distribuição utilizadores</h4> </div> <div class="widget_contents nopadding" style="height:450px;"> <div id="map-canvas"></div> </div> </div> <div class="g_12"> <div class="widget_header"> <h4 class="widget_header_title wwicon i_16_valid">distribuição salas</h4> </div> <div class="widget_contents nopadding" style="height:450px;"> <div id="room-canvas"></div> </div> </div>
if maps divs invisible, must apply height style directly on divs.
if it's not case, please provide console log of 2 map objects
Comments
Post a Comment