谷歌地图中infowindow的最大宽度?

时间:2013-05-22 10:51:55

标签: google-maps

我创建信息窗口的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);
                    });

1 个答案:

答案 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);
                    });