2013-05-22 193 views
1

的创建信息窗口我的谷歌地图代码的部分是:谷歌地图infowindow的maxWidth?

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

我需要的一个250像素最大宽度设置为信息窗口,但我不能得到它的工作。是否有语法错误有以下:

    google.maps.event.addListener(marker, 'click', function() { 
        infowindow.setContent(this.html); 
        infowindow.maxWidth(250); 
        infowindow.open(map, this); 
        }); 
+0

信息窗口类没有得到任何'maxWidth'方法 – duncan

回答

2

工作:

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