Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
Last active December 22, 2015 08:39
Show Gist options
  • Save JacobHsu/6446918 to your computer and use it in GitHub Desktop.
Save JacobHsu/6446918 to your computer and use it in GitHub Desktop.
var infowindow = new google.maps.InfoWindow();
//var pinkmarker = new google.maps.MarkerImage('./pink_Marker.png', new google.maps.Size(20, 34) );
//var shadow = new google.maps.MarkerImage('./shadow.png', new google.maps.Size(37, 34) );
function initialize() {
document.getElementById("debug").innerHTML= debugStr;
//document.getElementById('map').index = 1;
map = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 8,
//center: new google.maps.LatLng<?php echo $coordinates ?>,
center: new google.maps.LatLng(25.0461711884,121.5152664185), //23.714954, 120.99359); //南投縣信義鄉
mapTypeId: google.maps.MapTypeId.ROADMAP,
// zoomControl: true,
// zoomControlOptions: {
// style: google.maps.ZoomControlStyle.LARGE,
// position: google.maps.ControlPosition.RIGHT_CENTER
// }
});
var locations = [
{
latlng : new google.maps.LatLng(25.0336148, 120.56480220000003),
info : "hello"
},
{
latlng : new google.maps.LatLng(25.0336148, 121.56480220000003),
info : "world"
}
];
for (var i = 0; i < locations.length; i++) {
var marker = new google.maps.Marker({
position: locations[i].latlng,
//icon: pinkmarker,
//shadow: shadow,
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i].info);
infowindow.open(map, marker);
}
})(marker, i));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment