Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a question how i can change this code

selectedFeature = feature;
popup = new OpenLayers.Popup.FramedCloud("chicken", 
  feature.geometry.getBounds().getCenterLonLat(),
  null,
  div,
  null, null, onPopupClose);
feature.popup = popup;

to make the center point of popup window exactly where I've clicked, not like it is now on the center of object bounds?

Thanks in advance.

share|improve this question
add comment

1 Answer 1

I have a not tested proposition :

1 - From that example you will be able to get coordinates from click -see also that example.

2 - You will, then be able to convert coordinates to pixel, with that function.

3 - Finally, you move the popup with popup.moveTo(new OpenLayers.Pixel(xxx));.

You probably have to calculate it before, regarding popup width and height. With the help of jQuery it can even be dynamic.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.