簡體   English   中英

圖釘未顯示在Chrome Google Maps Api V3中

[英]Pins not showing up in Chrome Google Maps Api V3

由於某些原因,我的密碼未在Chrome瀏覽器中顯示。 他們使用野生動物園,歌劇,Firefox等,但不使用Chrome。

我在Google api庫中收到未定義的typeerror,因此無法執行任何操作。

這是我添加我的谷歌地圖的代碼:

var map;
function loadStores(){

google.maps.visualRefresh = true;
if(typeof google === 'object' && typeof google.maps === 'object'){
    try{
        var mapoptions = {
            center: new google.maps.LatLng(41.492537, -99.901813),
            zoom: 5,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            mapTypeControl: false,
            zoomControl: false,
            streetViewControl: false,
            panControl: false
        };

        map = new google.maps.Map(document.getElementById("store_map"),
        mapoptions);
        google.maps.event.trigger(map, 'resize');

        addStores();
    }catch(e){
        console.log(e);
    }
}
}

這是我的將商店(大頭針)添加到地圖的代碼:

if(typeof google === 'object' && typeof google.maps === 'object'){
    try{
        $.ajax({
            type:"GET",
            url: api_url + '/locations',
            success: function(data){
                var stores = $.parseJSON(data);

                for(var i=0; i<stores.length; i++){
                    console.log("hallo");
                    var ii = i;
                    var image = new google.maps.MarkerImage('images/store/pin_@2x.png', null, null, null, new google.maps.Size(32,50));
                    var myLatLng = new google.maps.LatLng(stores[ii].latitude, stores[ii].longitude);

                    var marker = new google.maps.Marker({
                        position: myLatLng,
                        map:map,
                        icon: image,
                        tel: stores[ii].tel,
                        state: stores[ii].state,
                        street: stores[ii].street
                    });

                    google.maps.event.addListener(marker, 'click', function(){
                        opPinGeklikt(event, this);
                    });
                }

            },error:function(){
                console.log(arguments);
            }
        });

    }catch(e){
        console.log(e);
    }
}

任何困難都將是偉大的。

確定找到了。 我在Chrome OS上的其他筆記本電腦上對其進行了測試,它的魅力十足。 我重新安裝(更新了?)我的chrome操作系統,似乎可以解決問題。 相當愚蠢,但確實有效。

暫無
暫無

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

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