3

私は大学の Web 開発者で、現在マップの作成に取り組んでいます。サイトはここにあります。各見出しの下には、見出しをクリックすると画鋲が表示されます。画鋲をクリックすると (マップまたはサイドバーのいずれかで)、情報ウィンドウがポップアップし、その場所に関する簡単な抜粋が表示されます。通常は、その横に写真が表示されます。残念ながら、過去 2 か月間で、すべての情報ウィンドウが表示されなくなりました。jquery が最新であることを確認し、作成したカスタム JavaScript を実行して、重大な変更があるかどうかを確認しました (私が知る限り、変更はありません)。それを壊した可能性のある Google Maps API の最近の更新があったかどうか疑問に思っています。潜在的な問題領域を特定しようとしてスクリプトをステップ実行していますが、乾燥しています。

(編集) 関連するコードを情報ウィンドウに投稿します。そうしないと、誰にとっても頭痛の種になります。

for (var i in data.d.Buildings) {
    var color = categories[4].Color.substring(1);
    var myLatLng = new google.maps.LatLng(data.d.Buildings[i].Latitude, data.d.Buildings[i].Longitude);
    var image = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + data.d.Buildings[i].LegendKey + '|' + color + '|ffffff';
    categoryItems['search'][i].marker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image,
        pushpinInfo: data.d.Buildings[i]
    });

    google.maps.event.addListener(categoryItems['search'][i].marker, 'click', function () {
        infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Acronym + '" />' : '') + this.pushpinInfo.Description + '</div>';
        infowindow.open(map, this);
    });

    addPushpinToMenu(categoryItems['search'][i], 'search', image);
    count++;
}

    if (data.d.ParkingLots[i].Name != null && data.d.ParkingLots[i].Name != "") {
        google.maps.event.addListener(categoryItems['search'][count].marker, 'click', function () {
            infowindow.content = '<div class="bubble">' + (this.pushpinInfo.Name != null ? '<h3>' + this.pushpinInfo.Name + '</h3>' : '') + (this.pushpinInfo.Description != null ? this.pushpinInfo.Description : '') + '</div>';
            infowindow.setPosition(this.centerLatLng);
            infowindow.open(map);
        });
    }

    google.maps.event.addListener(categoryItems['search'][count].marker, 'click', function () {
        infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Acronym + '" />' : '') + this.pushpinInfo.Description + '</div>';
        infowindow.open(map, this);
    });

        if (data.d[i].ParkingLots[a].Name != null && data.d[i].ParkingLots[a].Name != "") {
            google.maps.event.addListener(categoryItems[6][i].ParkingLots[a].marker, 'click', function () {
                infowindow.content = '<div class="bubble">' + (this.pushpinInfo.Name != null ? '<h3>' + this.pushpinInfo.Name + '</h3>' : '') + (this.pushpinInfo.Description != null ? this.pushpinInfo.Description : '') + '</div>';
                infowindow.setPosition(this.centerLatLng);
                infowindow.open(map);
            });
        }

    google.maps.event.addListener(categoryItems[data.d[0].TypeID][i].marker, 'click', function () {
        infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Name + '" />' : '') + this.pushpinInfo.Description + '</div>';
        infowindow.open(map, this);
    });
4

1 に答える 1

2

この問題は jQuery のバージョンとは関係ありません。問題を起こすのは Maps-API のバージョンです (3.10 以降)。

infoWindows の content-property を直接設定すると、3.10 以降で失敗するようです。

スクリプトを修正する (setContent()代わりに使用する) か、API バージョンを指定することができます。

https://maps.googleapis.com/maps/api/js?v=3.9&sensor=false 

(ただし、修正することをお勧めします)

于 2013-01-26T17:41:48.747 に答える