-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-play.html
54 lines (50 loc) · 1.18 KB
/
js-play.html
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
<!-- key=AIzaSyAgXKvcA_wB6l60kWyuyNWeYTP2zrVr6oo -->
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src="js/gmaps.js"></script>
<style type="text/css">
#map {
width: 100%;
height: 400px;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = new GMaps({
el: '#map',
lat: -12.043333,
lng: -77.028333
});
map.addControl({
position: 'top_right',
content: 'Geolocate',
style: {
margin: '5px',
padding: '1px 6px',
border: 'solid 1px #717B87',
background: '#fff'
},
events: {
click: function(){
GMaps.geolocate({
success: function(position){
map.setCenter(position.coords.latitude, position.coords.longitude);
},
error: function(error){
alert('Geolocation failed: ' + error.message);
},
not_supported: function(){
alert("Your browser does not support geolocation");
}
});
}
}
});
</script>
</body>
</html>