Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a map with some markers. On clicking a marker, a popup would appear and on clicking the map, any visible popup would be hidden. I want to hide any currently visible popup upon clicking a marker as well, and introduced a line of code in the following event listeners:"click", marker, function(event) {"click", map); // this line of code added;
});"click", map, function(event) {

However, I get an error upon clicking of a marker with the error given as "px is undefined" on line 1981 in Openlayers.debug.js file, which is the Openlayers.Pixel class with distanceTo method. I am not sure what is wrong and can't seem to make sense of it.

Can anyone help me? Thanks.

share|improve this question

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

I'm not your downvoter ..but if you create a JS Fiddle demonstrating this works, I have a hunch you'll get some upvoters (including me). Here's one I started you're welcome to expand on and finish. – elrobis Feb 27 '15 at 17:47

triggerEvent wants an event as second argument and that event apparently needs an "xy" property with the coordinates like that:

event.xy = {x: 0, y: 0}

Fixes the error message but unfortunately still does not trigger the popup for me.

share|improve this answer

Your Answer


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.