how to display a popup with the appropriate position?
map.on('singleclick', function (evt) {
overlayPopup.setPosition(undefined);
closer.blur();
var features = [];
var layers = [];
var feature = map.forEachFeatureAtPixel(evt.pixel, function
(feature, layer) {
features.push(feature);
layers.push(layer);
});
if (layers[0] == Layer1Popup) {
showLayer1Popup(features);
}
});
function showLayer1Popup(features) {
feature = features[0];
var coord = feature.getGeometry().getCoordinates();
if (feature) {
content.innerHTML = '<b>Name : ' + feature.get('name') +
'</b><br><br>Phone: ' + feature.get('phone');
overlayPopup.setPosition(coord);
}
}
--
You received this message because you are subscribed to the Google Groups
"OpenLayers Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/openlayers-dev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/openlayers-dev/76df9e75-d865-472b-8043-8e534a1cf5cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.