Skip to content

Instantly share code, notes, and snippets.

@arodbits
Forked from tommcfarlin/1-infowindow-content.js
Last active October 4, 2016 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arodbits/8ad6d5f90353cc761fbf to your computer and use it in GitHub Desktop.
Save arodbits/8ad6d5f90353cc761fbf 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