-
Notifications
You must be signed in to change notification settings - Fork 7
/
example.html
42 lines (37 loc) · 1.6 KB
/
example.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title>GoogleMaps Geolocation with jQuery</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<div id="container">
<div id="mapCanvas">
Loading Map
</div>
<div id="addressList">
<ul>
<li><a href="#">1 Infinite Loop, Cupertino, Santa Clara, California 95014</a></li>
<li><a href="#">Av. Infante Dom Henrique Aterro do Flamengo RJ, Rio de Janeiro</a></li>
<li><a href="#">Praça do Papa, Belo Horizonte - Minas Gerais, Brasil</a></li>
</ul>
</div>
</div>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.js" type="text/javascript"></script>
<script src="jquery.geolocation.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var firstAddress = $("#addressList li:first a").html();
$("#mapCanvas").geolocate(firstAddress);
$("#addressList li a").click(geolocateAddress);
});
function geolocateAddress(event) {
var address = $(this).html();
$("#mapCanvas").geolocate(address);
}
</script>
</body>
</html>