【问题标题】:How to Modify the InfoWindow Of Goole Map DirectionRender markers如何修改谷歌地图方向渲染标记的信息窗口
【发布时间】:2017-08-31 06:48:16
【问题描述】:

DirectionRender 将 A、B、C 等标记绘制为 Route 之间的航路点。如果我们单击该标记,它会显示包含地址的默认信息窗口。所以我想把我的自定义信息窗口放在那个 Markeres 上怎么做??

【问题讨论】:

标签: google-maps


【解决方案1】:

您可以通过创建如下变量为信息窗口提供自定义内容:

var content = '<h1>Custom heading</h1>' + '<p>Custom paragraph</p>';

并在 google.maps.Infowindow 中将此变量传递为:

var infowindow = new google.maps.InfoWindow({
   content: content,
   maxWidth: 350
});

并添加一个事件监听器:

google.maps.event.addListener(marker, 'click', function() {
  infowindow.open(map,marker);
 );

【讨论】:

    猜你喜欢
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多