我试图使用Google maps V3 API实现基于地图/方向的应用程序。到目前为止,我已经能够显示地图并显示选定的两个位置的方向。Google maps API V3 - DirectionsRendererOptions和InfoWindow中的自定义内容
但是我无法使用DirectionsRendererOptions在InfoWindow上设置自定义内容。下面给出的是我正在使用的。
var renderer = new google.maps.DirectionsRenderer(
{
infoWindow : new google.maps.InfoWindow(
{
content : "This is a test"
}
)});
似乎自定义InfoWindow正在设置,因为当在新的InfoWindow上设置disableAutoPan属性时,会发生预期的行为。但是内容没有设置。
有没有一种方法可以访问InfoWindow的内容(由DirectionsRenderer生成)并更新它?
在此先感谢。
单击标记时在其中呈现文本信息的InfoWindow。现有的信息窗口内容将被覆盖并移动其位置。如果未指定信息窗口,DirectionsRenderer将创建并使用其自己的信息窗口。如果suppressInfoWindows设置为true,则该属性将被忽略。 – 2012-01-26 13:39:45