InfoWindows在谷歌地图上

时间:2013-09-04 17:18:33

标签: google-maps-api-3

当我点击标记时,我可以使用google map api 3中的infoWindows功能进行那种google infoWindows吗?

http://i40.tinypic.com/25unplc.png

var infowindow = new google.maps.InfoWindow({
  content:"Hello World!"
  });

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

我甚至无法在这些信息窗口中进行换行...

1 个答案:

答案 0 :(得分:1)

将html代码添加到您的infowindow以应用以下样式:

var contentString = '<div id="content">'+
        '<h2>Meta Creation</h2><br/>'+
        '<div id="bodyContent">'+
        '&nbsp;&nbsp;&nbsp;'+
        '</div>'+
        '</div>';

infowindow.setContent(contentString);

注意:刚刚使用了一些html标签来展示示例。根据您的要求进行更改。