【发布时间】:2015-06-26 16:43:25
【问题描述】:
作为this question 的延续,我尝试将相应的 json 对象名称添加到 infowindow 内容中,
var infowindow = new google.maps.InfoWindow({
content:i
});
在this fiddle 中给出,但它只显示最后一个对象的名称。我也试过return函数作为
google.maps.event.addListener(poly, 'click', (function(event, (poly, i)) {
return function() {
infowindow.open(map);
infowindow.setPosition(event.latLng);
}
})(poly, i));
但没用 (fiddle)。我怎样才能实现它?
【问题讨论】:
-
无法使用上述链接中的解决方案。 jsfiddle.net/mpsbhat/whop1j4e/18
-
你看到your fiddle
Uncaught SyntaxError: Unexpected token (中的javascript错误了吗 -
或者the fiddle in your comment中的javascript错误:
Uncaught ReferenceError: infowindow is not defined
标签: google-maps polyline