Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controlling the width of a Google Maps InfoWindow

Tags:

Anyone know how to set the width of the InfoWindow in Google Maps? The infowindow is the cartoon like bubble that pops up when you click on a point in Google Maps. I can control the height via CSS but cannot figure out how to change the width (I want thinner than the default infowindow).

I found a reference to maxWidth in the API but I cannot figure out where to put this. Any ideas?

like image 853
rg88 Avatar asked Oct 02 '10 03:10

rg88


1 Answers

For v3 of the API, the InfoWindowOptions.maxWidth property does what you're asking for. The InfoWindow constructor takes an optional argument of an InfoWindowOptions object.

var iw = new google.maps.InfoWindow({ content: some_text, maxWidth: 200 }); 

The documentation notes that the "value is only considered if it is set before a call to open. To change the maximum width when changing content, call close, setOptions, and then open."

like image 150
fortboise Avatar answered Oct 15 '22 05:10

fortboise