Update examples to use new bootstrap tooltip

This commit is contained in:
Maximilian Krög
2022-08-21 11:50:47 +02:00
parent 523a33c81a
commit 8d1d1b0680
14 changed files with 117 additions and 87 deletions

View File

@@ -43,19 +43,22 @@ const vienna = new Overlay({
});
map.addOverlay(vienna);
const element = popup.getElement();
map.on('click', function (evt) {
const element = popup.getElement();
const coordinate = evt.coordinate;
const hdms = toStringHDMS(toLonLat(coordinate));
$(element).popover('dispose');
popup.setPosition(coordinate);
$(element).popover({
container: element,
placement: 'top',
let popover = bootstrap.Popover.getInstance(element);
if (popover) {
popover.dispose();
}
popover = new bootstrap.Popover(element, {
animation: false,
html: true,
container: element,
content: '<p>The location you clicked was:</p><code>' + hdms + '</code>',
html: true,
placement: 'top',
title: 'Welcome to OpenLayers',
});
$(element).popover('show');
popover.show();
});