私のプロジェクトは、情報ウィンドウがプロジェクトで一度だけ表示されるという点で、単一の JQM です。別のページに移動してからマップ ページに戻ると、情報ウィンドウがデッド状態になります。それを回復する方法。
firstmap = new google.maps.Map(document.getElementById("map"), myOptions);
var latlng = new google.maps.LatLng(Lat, Long);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
firstmap.setZoom(10);
marker = new google.maps.Marker({
icon:image,
position: latlng,
map: firstmap
});
infowindow.setContent(results[1].formatted_address);
infowindow.open(map, marker);
google.maps.event.addListener(marker, 'click', clearWindow);
}
} else {
alert("Geocoding failed to this location " + status);
}
});
}
function clearWindow() {
if (infowindow) {
google.maps.event.clearInstanceListeners(infowindow);
infowindow = null;
}
infowindow = new google.maps.InfoWindow();
}
情報ウィンドウ内のデータを消去する必要があります。いくつかのアイデアを提案してください