diff --git a/examples/icon.js b/examples/icon.js index 3b91d37c5a..de96dc3680 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -59,7 +59,8 @@ var element = document.getElementById('popup'); var popup = new ol.Overlay({ element: element, positioning: 'bottom-center', - stopEvent: false + stopEvent: false, + offset: [0, -50] }); map.addOverlay(popup); @@ -70,7 +71,8 @@ map.on('click', function(evt) { return feature; }); if (feature) { - popup.setPosition(evt.coordinate); + var coordinates = feature.getGeometry().getCoordinates(); + popup.setPosition(coordinates); $(element).popover({ 'placement': 'top', 'html': true,