Evanss
Evanss

Reputation: 23593

maxWidth for infowindow in googlemaps?

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

Upvotes: 7

Views: 4833

Answers (1)

Evanss
Evanss

Reputation: 23593

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

Upvotes: 10

Related Questions