Set Google Maps Container DIV width and height 100%

后端 未结 12 957
遇见更好的自我
遇见更好的自我 2020-11-28 04:45

I loaded Google Maps API v3 and print Google Map in div. But when set width & height to 100% and auto I can\'t see the Map.

Here is HTML code snippe

12条回答
  •  Happy的楠姐
    2020-11-28 05:38

    Gmap writes inline style position to relative to the div. Overwrite that with :

    google.maps.event.addListener(map, 'tilesloaded', function(){
        document.getElementById('maps').style.position = 'static';
        document.getElementById('maps').style.background = 'none';
    });
    

    Hope it helps.

提交回复
热议问题