Skip to content

Instantly share code, notes, and snippets.

@oliwa
Created June 3, 2016 07:53
Show Gist options
  • Save oliwa/ace33f77519cc056b0d5f13640acfdd9 to your computer and use it in GitHub Desktop.
Save oliwa/ace33f77519cc056b0d5f13640acfdd9 to your computer and use it in GitHub Desktop.
Google Map
<div id="map" style="height: 420px; width: 100%;"></div>
<script>
function initMap() {
var mapDiv = document.getElementById('map');
var myLatLng = {lat: 52.251458, lng: -0.118886};
var map = new google.maps.Map(mapDiv, {
center: myLatLng,
zoom: 15
});
var marker = new google.maps.Marker({
position: myLatLng,
animation: google.maps.Animation.DROP,
map: map,
title: 'MAP BioPharma'
});
var contentString = '<div id="map-infowindow">'+
'<strong>MAP BioPharma Limited</strong><br/>'+
'Upper Pendrill Court<br/>'+
'Ermine Street North<br/>'+
'Papworth Everard<br/>'+
'Cambridge, CB23 3UY, UK<br/>'+
'<a target="_blank" href="https://www.google.de/maps/dir//52.2514581,+-0.1188862/@52.2518839,-0.1891363,12z/data=!3m1!4b1!4m6!4m5!1m0!1m3!2m2!1d-0.1188862!2d52.2514581?hl=en">Directions</a>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
infowindow.open(map,marker);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap" async defer></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment