簡體   English   中英

谷歌地圖顯示亂碼

[英]Google maps displaying jibberish

我的地圖渲染不正確。

胡言亂語地圖

我從未經歷過這種情況(注意右側按鈕上的圖標被扭曲了)。 用於生成地圖的代碼非常簡單:

<script>
    function initMap() {
        var mapDiv = document.getElementById('map');
        var map = new google.maps.Map(mapDiv, {
            center: {lat: 43.828430, lng: 18.3445995},
            zoom: 18
        });

        new google.maps.Marker({
            position: {lat: 43.828430, lng: 18.3445995},
            map: map
        });
    }
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA9zhNUfid1PgR6FZ-g8xTp_NCqV3JvsHM&callback=initMap" async defer></script>

有任何想法嗎?

不知道為什么,但是當我嘗試您的代碼時,它起作用了,但地圖也是灰色的。 當我指出style="width:500px;height:500px"地圖開始工作

好的,問題是我有一個錯誤的 CSS 規則干擾了谷歌的渲染。

作為參考,img 上的最大寬度為 100%。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM