Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

click handler in marker using openlayer

Tags:

openlayers

I am using openlayers,when I query a list of pois from the server,I want to add the to the map one for each.

So I create marker for each of them,and I want a FrameCloud open when the marker is clicked.

I use this:

marker.events.resgister("click",marker,function(){
  this.pop.show();
});

However,when I drag the marker,the map will moved,and the event is triggered.

While I want nothing happen when use drag the marker,and the cursor should be pointer when mouseover the marker. Just like the google's marker.

How to implement this?

like image 362
hguser Avatar asked Mar 08 '26 18:03

hguser


1 Answers

Try this:

marker.events.register('mousedown', marker, function(evt){
 this.pop.show();
 OpenLayers.Event.stop(evt); 
});
like image 121
winsent Avatar answered Mar 10 '26 14:03

winsent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!