forked from Alain1405/leafletjs-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaflet-overintent-demo.html
64 lines (58 loc) · 1.91 KB
/
leaflet-overintent-demo.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
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Leaflet.OverIntent</title>
<script type='text/javascript' src="http://cdn.leafletjs.com/leaflet-0.6.3/leaflet.js"></script>
<script type='text/javascript' src="js/bouncemarker.js"></script>
<script type='text/javascript' src="js/leaflet.overintent.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.6.3/leaflet.css">
<style type='text/css'>
#map {
position: absolute;
top:0;
left: 0;
right: 0;
bottom:0;
}
.help {
font-size: 1.5em;
position: absolute;
top:0;
left: 0;
right: 0;
height: 30px;
z-index: 10;
background-color: rgba(0,0,0,0.5);
color: white;
padding: 10px;
margin: 0px;
text-align: center;
}
</style>
</head>
<body>
<p class="help">Move your mouse over, and observe the difference !</p>
<div id="map"></div>
<script type='text/javascript'>
window.onload = function () {
var map = L.map('map').setView([48.49, 1.36], 14);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
for (var i=0; i<100; i++) {
var lat = Math.random()/50 + 48.48
, lng = Math.random()/50 + 1.38;
L.marker(L.latLng([lat, lng]), {radius:1}).addTo(map)
.on('mouseintent', function () { this.bounce(300, 50) ; });
}
for (var i=0; i<100; i++) {
var lat = Math.random()/50 + 48.48
, lng = Math.random()/50 + 1.32;
L.marker(L.latLng([lat, lng]), {radius:1}).addTo(map)
.on('mouseover', function () { this.bounce(300, 50) ; });
}
};
</script>
</body>
</html>