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 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:

marker.events.register("click", marker, function(event) {
 map.events.triggerEvent("click", map); // this line of code added
 popup.show();
});
map.events.register("click", map, function(event) {
 popup.hide();
});

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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.