Skip to content

Instantly share code, notes, and snippets.

@andrepadez
Created March 27, 2014 16:32
Show Gist options
  • Save andrepadez/9811782 to your computer and use it in GitHub Desktop.
Save andrepadez/9811782 to your computer and use it in GitHub Desktop.
(function setupGoogleMaps(){
if(typeof google === 'undefined'){ return; }
//Instantiate map object and set core options
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(52.37022, 4.89517),
zoom: 6,
disableDefaultUI: true
});
//Instaniate infoWindow and marker image objects
var infoWindow = new google.maps.InfoWindow();
var image = new google.maps.MarkerImage("img/small-logo2.png");
var shadow = new google.maps.MarkerImage("img/shadow-small-logo.png",
new google.maps.Size(54.0, 41.0),
new google.maps.Point(0, 0),
new google.maps.Point(16.0, 20.0));
var marker = new google.maps.Marker({
position: new google.maps.LatLng(52.37022,4.89517),
icon: image,
shadow:shadow,
map: map,
title:"title"
});
var title ="Title";
var message = "Address";
google.maps.event.addListener(marker, 'click', function (){
map.setZoom(15);
map.setCenter(marker.getPosition());
infoWindow.setContent(message);
infoWindow.open(map, marker, title);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment