On Jun 8, 11:38 am, volksman <[email protected]> wrote: > I must be doing something stupid here. Can anyone spot it? I'm > building multiple markers based on this example: > > http://gmaps-samples-v3.googlecode.com/svn/trunk/single-infowindow/si... > > But it will only render the last marker/content I pass it.
Does this help? http://www.geocodezip.com/v3_markers_infowindows.html It is based off a different example. -- Larry > > iw = new google.maps.InfoWindow(); > > google.maps.event.addListener(map, 'click', closeInfoWindow); > > function openIW(marker, content){ > iw.setContent(content); > iw.open(map,marker); > } > > function closeInfoWindow(){ > iw.close(); > } > > for (var i = 0; i < locations.length; i++) { > var sch = locations[i]; > > var contentString = '<div id="content">'+ > '<h5>' + sch[0] + '</h1>'+ > '<div id="bodyContent">'+ > '<ul>' + > '<li>' + sch[5] + '</li>' + > '<li>Board: ' + sch[6] + '</li>' + > '<li>Grades: ' + sch[7] + ' - ' + sch[8] + > '<li><a href="' + sch[4] + '">School Website</a></ > li>' + > '</div>'+ > '</div>'; > //var infowindow = new google.maps.InfoWindow({ > // content: contentString > //}); > > var myLatLng = new google.maps.LatLng(sch[1], sch[2]); > var marker = new google.maps.Marker({ > position: myLatLng, > map: map, > shadow: shadow, > icon: image, > shape: shape, > title: sch[0], > zIndex: sch[3] > }); > //google.maps.event.addListener(marker, 'click', > function() { > // infowindow.open(map, marker); > //}); > google.maps.event.addListener(marker, 'click', function() > { > openIW(marker, contentString); > }); > } > > The markers appear as they should but no matter which marker I click > on it renders over the last marker in my list and shows that markers > content (not the one I clicked on). > > Any help appreciated! -- 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.
