Hi, I had the same issue and it bothered me no end. I found your post and realized you're using the same appproach as me (more or less). So I thought I'd share my solution with you. Try replacing: infoWindow.open(map, this); With: infoWindow.open(marker.getMap(), marker); This solved it for me. Only thing that troubbles me is that i don't really understand why! If it works for you perhaps you can help me explaint it? Or is there someone else out there who can help shed some light on this?
On Nov 13 2011, 1:02 am, Lothaire Ruellan <[email protected]> wrote: > I have an issue that I have been unable to troubleshoot with my > infowindows. You can view the page where the problem occurs > athttp://www.queenofnewyork.com/ > Click any marker on the map, and as soon as it appears, a javascript error > is registered, which prevents the infowindow from closing. > > My map code is contained in a javascript class > (http://www.queenofnewyork.com/wp-content/themes/queenofnewyork/js/map.js) > Inside, I have a method called showMarkers which takes as argument an > array, as follows: > > this.showMarkers = function (places) { > for ( var i = 0 ; i < places.length ; i++) { > var marker = new google.maps.Marker({ > position: places[i]['LatLng'], > map: this.map, > title: places[i]['title'], > icon: icon, > html: places[i]['html'] > }) > google.maps.event.addListener(marker, 'click', function () { > infoWindow.setContent(this.html) ; > infoWindow.open(map, this); > }); > markersArray.push(marker); > } > > My markers and infowindow appear as expected, but I'm stuck with this > javascript error which prevents the infowindow from closing. > Any idea what I am doing wrong? > Thanks in advance for your help. > > Lothaire -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
