-
Notifications
You must be signed in to change notification settings - Fork 2
/
mapevent.html
39 lines (34 loc) · 1.02 KB
/
mapevent.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
<!DOCTYPE html>
<html>
<head>
<title>MapQuest Leaflet plugin with map event handling</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<script src="//www.mapquestapi.com/sdk/leaflet/v2.s/mq-map.js?key=KEY"></script>
<script type="text/javascript">
"use strict";
var L, MQ, map;
window.onload = function() {
map = L.map('map', {
layers: MQ.mapLayer(),
center: [ 40.731701, -73.993411 ],
zoom: 12
});
map.on('mousemove', function(e) {
document.getElementById('txt').innerHTML = e.latlng.wrap().lat + ',' + e.latlng.wrap().lng;
});
};
</script>
<style>
#map {
width: 800px;
height: 600px;
}
</style>
</head>
<body>
<div id="map"></div>
<div id="txt"></div>
</body>
</html>