我创建信息窗口的Google地图代码部分是:
google.maps.event.addListener(marker, 'click', function () {
infowindow.setContent(this.html);
infowindow.open(map, this);
});
我需要将最大宽度设置为250px到infowindow,但我无法让它工作。是否存在以下语法错误:
google.maps.event.addListener(marker, 'click', function () {
infowindow.setContent(this.html);
infowindow.maxWidth(250);
infowindow.open(map, this);
});
答案 0 :(得分:5)
工作:
google.maps.event.addListener(marker, 'click', function () {
// where I have added .html to the marker object.
infowindow.setContent(this.html);
infowindow.setOptions({maxWidth:250});
infowindow.open(map, this);
});