-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarker_dynamic_content.html
56 lines (52 loc) · 1.45 KB
/
marker_dynamic_content.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
<html>
<head>
<title>geoportail.lu API v3 samples</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="https://apiv3.geoportail.lu/apiv3loader.js" type="text/javascript"></script>
<style>.maclasse {display:flex;align-items:center;}</style>
</head>
<body>
<div id="map2c"></div>
<div id="info2c"></div>
<script>
var position = [75977, 75099 ];
var map2c = new lux.Map({
position: position,
target: 'map2c',
bgLayer: 'basemap_2015_global',
zoom: 18
});
var markerOverlay = map2c.showMarker({
position: [75977, 75099 ],
positioning: 'center-center',
iconURL: '//apps.geoportail.lu/exemple_api/exemplesWikiGeoAPI/lion.png',
click: true,
});
var popup;
markerOverlay.element.addEventListener('mousemove', (function(event) {
var cb = function() {
map2c.removeOverlay(popup);
}.bind(this);
if (!popup) {
var element = lux.buildPopupLayout("new content number " + Date.now());
popup = new ol.Overlay({
element: element,
position: markerOverlay.getPosition(),
positioning: 'bottom-center',
offset: [0, -20],
insertFirst: false
});
}
popup.setPosition(markerOverlay.getPosition());
map2c.addOverlay(popup);
map2c.renderSync();
}));
markerOverlay.element.addEventListener( 'mouseout', function() {
if (popup) {
map2c.removeOverlay(popup);
popup = undefined;
}
}.bind(this));
</script>
</body>
</html>