Created
December 7, 2012 08:34
-
-
Save tsmsogn/4231806 to your computer and use it in GitHub Desktop.
JavaScript: Google Maps JavaScript API V3: How to make InfoWindow to each markers
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 infoWindow = new google.maps.InfoWindow(); | |
var marker = (function(data) { | |
var latLng = new google.maps.LatLng(data.latitude, data.longitude); | |
var marker = new google.maps.Marker({ | |
position: latLng, | |
icon: markerImage | |
}); | |
google.maps.event.addListener(marker, 'click', function(){ | |
infoWindow.setOptions({ | |
position: latLng, | |
content: getWindowHtml(data) | |
}); | |
infoWindow.open(map, marker); | |
}); | |
return marker; | |
})(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment