Skip to content

Instantly share code, notes, and snippets.

@michaelhelmick
Created April 23, 2011 20:01
Show Gist options
  • Save michaelhelmick/938921 to your computer and use it in GitHub Desktop.
Save michaelhelmick/938921 to your computer and use it in GitHub Desktop.
for(var i=0;i<data.length;i++)
{
var lat = data[i].latitude;
var lng = data[i].longitude;
var latLng = new google.maps.LatLng(lat, lng);
var marker = new google.maps.Marker({map: map, position: glatLng});
markersArray.push(marker);
// Set an attribute on the marker, it can be named whatever...
marker.html = '<div>My content goes here for ['+lat+', '+lng+']</div>';
google.maps.event.addListener(marker, 'click', function(){
// Set the content of the InfoBubble or InfoWindow
// They both have a function called setContent
infoBubble.setContent(this.html);
infoBubble.open(map, this);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment