Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created February 19, 2015 15:26
Show Gist options
  • Save tommcfarlin/f2391b72140454b56920 to your computer and use it in GitHub Desktop.
Save tommcfarlin/f2391b72140454b56920 to your computer and use it in GitHub Desktop.
Using Google Maps to add multiple windows to different pins located on the map.
var sContent =
'<h2>' + oLocation.title + '</h2>' +
'<br />' +
'<p>' +
oLocation.address1 + ' ' +
oLocation.address2 +
'<br />' +
oLocation.city +
'<br />' +
oLocation.province +
oLocation.zip +
'</p>';
infoWindow = new google.maps.InfoWindow({ content: sContent });
marker = new google.maps.Marker({
position: position,
map: map,
title: markers[i][0],
info: sContent
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener( marker, 'click', function() {
infoWindow.setContent( this.info );
infoWindow.open( map, this );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment