【发布时间】:2013-03-18 12:51:40
【问题描述】:
我的项目是单个 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();
}
我需要清除信息窗口中的数据。给我一些建议
【问题讨论】:
-
您是要关闭信息窗口还是只是想清除其中的内容?
-
@DeadMan 嗨,我需要清除内容。
标签: jquery google-maps jquery-mobile google-maps-api-3