views:

53

answers:

1

Hi,

I'm trying to add a few tweets to an infowindow in Google Maps. I get the tweets to display in a div that is the content of my infowindow, but it's the wrong size.

I thought by calling 'content_changed' when the marker is clicked, the infowindow would resize - it doesn't.

I'm sure this is pretty straightforward, can someone help me out?

Thanks,

James

var myLatlng = new google.maps.LatLng(51.500261,-0.126793);
var myOptions = {
  zoom: 12,
  center: myLatlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById("map_canvas"),
    myOptions);

var marker = new google.maps.Marker({
  position: myLatlng,
  map: map,
});

var infowindow = new google.maps.InfoWindow();
infowindow.setContent(document.getElementById("station"));

google.maps.event.addListener(marker, 'click', function() {
    google.maps.event.trigger(infowindow, 'content_changed');
    infowindow.open(map,marker);
});
A: 

Try to call infowindow.close(); before open(). I'm pretty sure that it will force it to rerender

fantactuka
thanks fantactuka
sandman