Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (51 sloc) 1.62 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
#map {
position: absolute;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<a href="https://onethinglab.wordpress.com/the-definitive-guide-to-google-maps-markers#marker-resize-image">How to resize marker image</a>
<div id="map"></div>
<script>
function add_marker(gmap, coordinates, icon) {
var marker = new google.maps.Marker({
position: coordinates,
map: gmap,
icon: icon
});
return marker;
}
function init_map() {
var places = {
'UA': { lat: 50.43333333, lng: 30.516667 },
'DE': { lat: 52.51666667, lng: 13.4 },
'GL': { lat: 64.18333333, lng: -51.75 },
'JP': { lat: 35.68333333, lng: 139.75 },
'MG': { lat: -18.91666667, lng: 47.516667 }
};
var gmap = new google.maps.Map(document.getElementById('map'),
{
zoom: 2,
center: { lat: -25.363, lng: 131.044 }
});
var size = 25;
for (var country in places) {
var icon = {
url: "images/pin.png",
scaledSize: new google.maps.Size(size, size),
};
add_marker(gmap, places[country], icon);
size += 10;
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=init_map"></script>
</body>
</html>