首页 文章

Google Map 未加载完整

提问于
浏览
-1

First I want to make clear that the solutions found here have not solved.

我正试图用简单的谷歌 Map 显示模态警报 . 更多Google Map 未加载完整:
Google Maps Not Load Full

My .js:

var map;
function initialize() {
    var mapOptions = {
        zoom : 8,
        center : new google.maps.LatLng(-34.397, 150.644),
        mapTypeId : google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}

google.maps.event.addDomListener(window, 'load', initialize);

function showModal() {
    $('#myModal').foundation('reveal', 'open');
}

HTML:

<div id="myModal" class="reveal-modal">
    <div id="map-canvas"></div>
    <a class="close-reveal-modal">&#215;</a>
</div>

I did the tests with:

google.maps.event.trigger(map, 'resize');

And:

$('#map-canvas').gmap().triggerEvent('resize');

Nothing works. Can anyone help? Thanks!

1 回答

  • 1

    您需要等到模态完成加载设置超时或在完成状态下使用模态回调然后启动 Map .

相关问题