A Pen by Stephen Ochieng on CodePen.
Last active
November 25, 2019 07:57
-
-
Save itsRealoj/78c7c335978e9d7e31925c2e3e96e18a to your computer and use it in GitHub Desktop.
Display Google map
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<head> | |
</head> | |
<body> | |
<h3>My Google Maps Demo</h3> | |
<!--The div element for the map --> | |
<div id="map"></div> | |
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB5OBQoffI187G4XX_IeCJBUGmt33d6yV0&callback=initMap"> | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
// Initialize and add the map | |
function initMap() { | |
// The location of Uluru | |
var uluru = {lat: -25.344, lng: 131.036}; | |
// The map, centered at Uluru | |
var map = new google.maps.Map( | |
document.getElementById('map'), {zoom: 4, center: uluru}); | |
// The marker, positioned at Uluru | |
var marker = new google.maps.Marker({position: uluru, map: map}); | |
let mapId = 'AIzaSyBhwwJqT3bvyL2Ck2uFNWlv2ZYH8DfGOdw'; | |
} | |
This file contains hidden or 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
/* Set the size of the div element that contains the map */ | |
#map { | |
height: 400px; /* The height is 400 pixels */ | |
width: 100%; /* The width is the width of the web page */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment