我的項目是一個JQM,在信息窗口出現只在項目一次。當我移動到另一頁面並返回到地圖頁面時,infowindow處於死亡狀態。如何恢復它。如何清除gmaps信息窗口
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();
}
我需要清除infowindow中的數據。建議我的一些想法
是否要關閉信息窗口,或者只是想清除裏面的內容? – 2013-03-28 06:50:18
@DeadMan嗨,只是我需要清除內容。 – 2013-03-28 06:51:03