forked from lubojr/leaflet-side-by-side
-
Notifications
You must be signed in to change notification settings - Fork 1
/
image-overlay-example.html
44 lines (38 loc) · 1.37 KB
/
image-overlay-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
43
44
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui' />
<title>Leaflet Side-by-side</title>
<script src='http://cdn.leafletjs.com/leaflet/v1.3.1/leaflet.js'></script>
<script src="leaflet-side-by-side.js"></script>
<link href='http://cdn.leafletjs.com/leaflet/v1.3.1/leaflet.css' rel='stylesheet' />
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id='map'></div>
<script>
var map = L.map('map').setView([23.140, -101.887], 5);
map.createPane('left');
map.createPane('right');
var newark = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
imageBounds = [[7.9409, -131.1589], [29.2144, -82.6558]];
var leftLayer = L.imageOverlay(newark, imageBounds, {pane: 'left'}).addTo(map);
var atlantis = 'https://img.vixdata.io/pd/jpg-large/es/sites/default/files/a/atlantis-ciudad-perdida.jpg',
imageBounds = [[7.9409, -131.1589], [29.2144, -82.6558]];
var rightLayer = L.imageOverlay(atlantis, imageBounds, {pane: 'right'}).addTo(map);
var ss = L.control.sideBySide(leftLayer, rightLayer).addTo(map);
</script>
</body>
</html>