Skip to content

Commit 2233a7b

Browse files
authored
Create README.md
1 parent 23b9f07 commit 2233a7b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# google-geolocate.js
2+
A Google Maps plugin that adds a geolocation control.
3+
4+
_For a working example see [demo](https://raruto.github.io/examples/google-geolocate/google-geolocate.html)
5+
---
6+
7+
## How to use
8+
9+
1. **include CSS & JavaScript**
10+
```html
11+
<head>
12+
...
13+
<style>html, body, #map { width: 100%; height: 100%; margin: 0; padding: 0; }</style>
14+
<script src="https://maps.google.com/maps/api/js?key="></script>
15+
<script src="https://raruto.github.io/cdn/google-geolocate/0.0.1/google-geolocate.js"></script>
16+
...
17+
</head>
18+
```
19+
2. **choose the div container used for the slippy map**
20+
```html
21+
<body>
22+
...
23+
<div id="map"></div>
24+
...
25+
</body>
26+
```
27+
3. **create your first simple “google-geolocate” slippy map**
28+
```html
29+
<script>
30+
var mapOpts = {
31+
center: new google.maps.LatLng(45, 9.5),
32+
zoom: 5,
33+
MapTypeId: google.maps.MapTypeId.ROADMAP
34+
};
35+
36+
var map = new google.maps.Map(document.getElementById('map'), mapOpts);
37+
var geolocationControl = new GeolocationControl(map, 13);
38+
</script>
39+
```
40+
41+
---
42+
43+
**Compatibile with:** [email protected]
44+
45+
---
46+
47+
**Contributors:** [Raruto](https://github.com/Raruto/google-geolocate)

0 commit comments

Comments
 (0)