Last active
February 21, 2023 08:24
-
-
Save TravelTime-Frontend/66ae176dc08f3804f8d2191b3dc8582f to your computer and use it in GitHub Desktop.
Google Maps JavaScript API initial setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
body { | |
background-color: gray; | |
} | |
html, | |
body, | |
#map { | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<div id='map'></div> | |
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_GOES_HERE&callback=initMap" async | |
defer></script> | |
<script> | |
var map; | |
function initMap() { | |
var mapOpts = { | |
center: { lat: 51.5031653, lng: -0.1123051 }, | |
zoom: 13, | |
}; | |
map = new google.maps.Map(document.getElementById('map'), mapOpts); | |
var marker0 = new google.maps.Marker({ | |
position: { lat: 51.5031653, lng: -0.1123051 }, | |
map: map, | |
title: 'London Waterloo train station', | |
animation: google.maps.Animation.DROP | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment