-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sContent = | |
'<h2>' + oLocation.title + '</h2>' + | |
'<br />' + | |
'<p>' + | |
oLocation.address1 + ' ' + | |
oLocation.address2 + | |
'<br />' + | |
oLocation.city + | |
'<br />' + | |
oLocation.province + | |
oLocation.zip + | |
'</p>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infoWindow = new google.maps.InfoWindow({ content: sContent }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marker = new google.maps.Marker({ | |
position: position, | |
map: map, | |
title: markers[i][0], | |
info: sContent | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
google.maps.event.addListener(marker, 'click', function() { | |
infowindow.open(map,marker); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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