Fix the popup in the geographic example

Set the container to prevent the popup from moving the element to the body.
Don't sanitze the html, as table is not in the list of allowed elements.
This commit is contained in:
Maximilian Krög
2020-07-28 20:21:12 +02:00
parent 517d38461c
commit 85e4a62553
2 changed files with 6 additions and 2 deletions

View File

@@ -13,6 +13,8 @@ resources:
- https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js
---
<div id="map" class="map"><div id="popup"></div></div>
<div id="map" class="map">
<div id="popup"></div>
</div>
<div id="info"></div>

View File

@@ -68,9 +68,11 @@ map.on('click', function (event) {
const coordinate = feature.getGeometry().getCoordinates();
popup.setPosition(coordinate);
$(element).popover({
placement: 'top',
container: element.parentElement,
html: true,
sanitize: false,
content: formatCoordinate(coordinate),
placement: 'top',
});
$(element).popover('show');
} else {