虽然开发这一解决方案,我才知道,API V2是被弃用。我从此开始使用API V3的版本。该工作正在进行中,您可以在My New Map找到。特别感谢大卫马兰在Hammerspace加速这个转换对我来说。谷歌地图API V3的信息窗口
我到其余3 issues..the其中第一个我将在这篇文章中解决。
我无法触发信息窗口我已经定义:
google.maps.event.addListener(polyline, 'click', function(event) {
if (polyline.Contains(event.latLng)) {
infowindowInside.open(map,polyline);
} else {
infowindowOutside.open(map,polyline);
}
});
我将它们连接到polygon..not标记。多边形是这样写的:
var path = [
new google.maps.LatLng(35.950079, -84.104977),
new google.maps.LatLng(35.950774, -84.049702),
new google.maps.LatLng(35.946883, -84.047813),
new google.maps.LatLng(35.945354, -84.045067),
new google.maps.LatLng(35.940907, -84.042149),
new google.maps.LatLng(35.930483, -84.037857),
new google.maps.LatLng(35.939656, -84.037857),
new google.maps.LatLng(35.928120, -84.076309),
new google.maps.LatLng(35.938822, -84.066868),
new google.maps.LatLng(35.950079, -84.104977)];
var polyline = new google.maps.Polygon({path:path, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2, clickable:false});
polyline.setMap(map);
我很感激你可以提供的任何指导。
谢谢。
**修订* ** * *
现在我已经修改了代码:
google.maps.event.addListener(polyline, 'click', function(event) {
if (polyline.ContainsLocation(event.latLng, polyline)) {
window.alert('inside');//infowindowInside.open(map,polyline);
} else {
window.alert('outside');//infowindowOutside.open(map,polyline);
}
});
However..still没有触发。
感谢,@Mano商标。请参阅我上面更新的内容。 – mcmonty 2012-03-21 15:09:30