-1

I am making a google map with a few locations. I've played with this for a few hours and can't seem to figure out where I need to set the appropriate values to make the infowindow bigger for each map marker.

Here is the function I am using to set the markers and infowindows. Where can I throw values in to change the size of the window. Thanks!

function setMarkers(map,locations){

        var marker, i

        for (i = 0; i < locations.length; i++)
          {  

            var location = locations[i][0]
            var lat = locations[i][1]
            var long = locations[i][2]
            var add =  locations[i][3]

            latlngset = new google.maps.LatLng(lat, long);

            var marker = new google.maps.Marker({  
              map: map, title: location , position: latlngset, icon: "tranePointer.png" 
            });
            map.setCenter(marker.getPosition())

            var content = "Location #: " + location +  ' </h3>' + "Place: " + add     
            var infowindow = new google.maps.InfoWindow()

            google.maps.event.addListener(marker,'click', (function(marker,content,infowindow){ 

           return function() {
            infowindow.setContent(content);
            infowindow.open(map,marker);
            };
        })(marker,content,infowindow)); 

      }

      document.getElementById("zipField").value= "";
  }
Salman A
  • 262,204
  • 82
  • 430
  • 521
David Webb
  • 253
  • 4
  • 18

1 Answers1

0

From the documentation:

content

Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size.

So this should work:

var content = '<div style="width: 200px; height: 200px;"><h3>Title</h3><p>Content</p></div>';
Salman A
  • 262,204
  • 82
  • 430
  • 521
  • I was wrong about the creating info window in loop part. Turns out that you _can_ create more then one info window. If you want to display one info window at a time [have a look at this question](http://stackoverflow.com/q/3059044/87015). – Salman A Nov 14 '14 at 19:33