1

すべての主要なブラウザーで、マップ上のマーカーは機能しますが、クロムでは機能しません。機能することもありますが、ほとんどの場合、理由もなく機能しません。私が得るエラーは次のとおりです: Uncaught TypeError: Type error as in this link. http://d.pr/i/Ojxc

Main.js へのリンクは、縮小された Google API js ファイルです。マップをズームアウトすると、エラーが何度も発生します。理由もなくズームが停止し、マップがブロックされます。

HTML ではすべてが正しく、ajaxcall は正しいデータを返し、Safari、Opera、Firefox で動作します。

私はここで必死です。

私のjsコード:

function addStores(){

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 indi = 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[i].latitude, stores[i].longitude);

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

                    google.maps.event.addListener(marker, 'click', function(){
                        console.log("hkom");
                        map.setCenter(new google.maps.LatLng(marker.position.lat(), marker.position.lng()));
                        map.setZoom(15);

                        console.log("hallo");
                        opPinGeklikt(event, this);
                    });
                }

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

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

}

事前にt​​hx。W.

4

1 に答える 1

5

クロム追加で機能させるには

最適化: false

オプションをマーカーに追加します。

于 2013-07-02T14:09:33.117 に答える