Skip to content

Commit 3751258

Browse files
committed
Adding Day #20
1 parent 78775ee commit 3751258

File tree

6 files changed

+68
-0
lines changed

6 files changed

+68
-0
lines changed

Day #20 - Google Maps API/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Day #20
2+
3+
### Google Maps
4+
In this tutorial ([Open in Youtube](https://youtu.be/KFAlHY6AQCI)), I am gonna showing to you how to use google maps api in javascript. we create a project that you can work with google map in javascript❗️Also this project is full responsive!
5+
6+
# Screenshot
7+
Here we have project screenshot :
8+
9+
![screenshot](ScreenShot-20.png)
557 KB
Loading

Day #20 - Google Maps API/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="style.css">
7+
<title>Day #20 - Google Map API | NaeuCode</title>
8+
</head>
9+
<body>
10+
11+
<div class="container">
12+
<div id="map"></div>
13+
</div>
14+
15+
16+
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
17+
<script src="script.js"></script>
18+
</body>
19+
</html>

Day #20 - Google Maps API/script.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
function initialize() {
3+
let mapOptions = {
4+
zoom: 10,
5+
center: new google.maps.LatLng(37.25, 55.16),
6+
mapTypeId: google.maps.MapTypeId.ROADMAP,
7+
minZoom: 2,
8+
};
9+
10+
let map = new google.maps.Map(document.getElementById("map"), mapOptions);
11+
12+
let infoWindow = new google.maps.InfoWindow();
13+
14+
let marker = new google.maps.Marker({
15+
position: new google.maps.LatLng(37.25, 55.16),
16+
map: map,
17+
title: "Iran, Gonbad-e Kavus"
18+
});
19+
20+
marker.addlistener("click", () => {
21+
infoWindow.setContent(marker.title);
22+
infoWindow.open(map, marker);
23+
});
24+
25+
google.maps.event.addDomListener(window, "resize", () => {
26+
map.setCenter(mapOptions.center);
27+
});
28+
}
29+
30+
google.maps.event.addDomListener(window, "load", initialize);

Day #20 - Google Maps API/style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
body{
2+
margin: 0;
3+
padding: 0;
4+
}
5+
6+
#map {
7+
width: 100%;
8+
height: 100vh;
9+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ Here we have list of projects:
3030
17. Breakout Game App
3131
18. Crypto Price App
3232
19. Shadow Generator
33+
20. Google Maps API

0 commit comments

Comments
 (0)