-
Notifications
You must be signed in to change notification settings - Fork 1
/
maps.js
56 lines (47 loc) · 1.33 KB
/
maps.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Script para controlar as funções do google maps
* Autor: Bruno Salmito
* Versão: 0.0.2
*/
function initMap() {
//Define a latitude e longitude do local onde o mapa ficará
//Centralizado
const cidade = {
lat: -3.721039,
lng: -40.991223
}
//Inicializa o mapa e centraliza nas coordenadas da cidade
var map = new google.maps.Map(
//Pega a id onde irá inicializar o mapa
document.getElementById('map'), {
zoom: 14,
center: cidade,
scrollwhell: false,
styles: [{
stylers: [{
//saturation: -100
}]
}] //fim do styles
});
//Adiciona marcador de localização na página
function addMarker(lat, lng, titulo) {
var myLatLng = {
lat,
lng
};
var info = '<p style="color:black;">' + titulo + '</p>';
var infoWindow = new google.maps.InfoWindow({
content: info
});
var marker = new google.maps.Marker({
position: myLatLng,
title: info,
map: map
});
marker.addListener('click', function () {
infoWindow.open(map, marker);
});
}
addMarker(-3.721039, -40.991223, 'Bruno Salmito');
} //fim do init map
initMap();