Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maxWidth for infowindow in googlemaps?

Tags:

google-maps

The part of my google maps code that creates info windows is this:

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

I need to set a max width of 250px to the infowindow but I cant get it to work. Is there a syntax error with the following:

                    google.maps.event.addListener(marker, 'click', function () {
                    infowindow.setContent(this.html);
                    infowindow.maxWidth(250);
                    infowindow.open(map, this);
                    });
like image 571
Evanss Avatar asked May 22 '13 10:05

Evanss


1 Answers

Working:

                    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);
                    });
like image 88
Evanss Avatar answered Sep 18 '22 12:09

Evanss