Controlling the width of a Google Maps InfoWindow

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?

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."


You can override the style of Google Maps.

/* Just use .gm-style-iw */ 
.gm-style-iw {
  width: 300px; 
  min-height: 150px;
}

Source: https://katz.co/resizing-infowindow/


you can add div at first like this:

<div style='width:300px;margin:0 0 20px 20px;height:90px;'>

Need Your Help

android webview geolocation

android geolocation

I have to retrieve a user's location in a WebView. I do this with the following Javascript:

Is there a WebSocket client implemented for Python?

python client-server xmpp websocket

I found this project: http://code.google.com/p/standalonewebsocketserver/ for a WebSocket server, but I need to implement a WebSocket client in python, more exactly I need to receive some commands ...