好的,有一个类似的问题,但它仍然没有解决。
是否可以在每个信息窗口中添加 Facebook 评论功能?单击地图上的点后,我希望在每个信息窗口中显示不同的 Facebook 评论流。我目前正在尝试,但如果有人知道怎么做,如果你能提供一些帮助,那将会很有帮助!
这是我到目前为止所拥有的:
<script type="text/javascript">
var map;
function initialize() {
var myOptions = {
zoom: 3,
center: new google.maps.LatLng(46.073231,-41.865238),
mapTypeId: google.maps.MapTypeId.ROADMAP,
map = new
google.maps.Map(document.getElementById('map'),
myOptions);
var locations = [
["Event",51.526902,-0.085588,"London, UK","Jan 23, 2012"],
["Event",34.083517,-118.389373,"Los Angeles, USA","Jan 25, 2012"],
["Event",40.716428,-73.966241,"New York, USA","Jan 30, 2012"],
["Event",40.723454,-73.986497,"Queens, USA","Jan 31, 2012"]
];
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++)
{
var iconImage, heading;
switch(locations[i][0]) {
case "Event":
iconImage = "img/event.png";
heading = "<h2 class='event'><img src="+iconImage+" />" +locations[i][3]+"</h2>";
break;
marker = new google.maps.Marker({
icon: iconImage,
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i, heading) {
return function() {
markerContent = heading+"<p><b></b> "+ locations[i][4]+"</p>";
infowindow.setContent(markerContent);
infowindow.open(map, marker);
}
})(marker, i, heading)); // end marker click function
}}; // end for loop
</script>