Question: I'm using OpenLayers 2.13. I want to detect `mousedown`, `mousemove`, `mouseup` events while mouse is over `OpenLayers.Map`, so I wrote the following code.

```
var map = new OpenLayers.Map("map",{controls:[
    new OpenLayers.Control.Navigation(),
    new OpenLayers.Control.ArgParser(),
    new OpenLayers.Control.Attribution()
]});
var events = map.events;
events.register("mousedown",map,function(e){
    console.log("mousedown");
});
events.register("mousemove",map,function(e){
    console.log("mousemove");
});
events.register("mouseup",map,function(e){
    console.log("mouseup");
});

```

As a result, `mousemove` and `mouseup` is detected but no `mousedown`s.

It says [here](http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.events) that `mousemove` and `mouseup` is supported but `mousedown` is not. Is there any hacks I can apply to detect `mousedown` events without modifying OpenLayers script?

Answer: 
if you using open layer API > 5 then us can use below code

```
 map.on('pointerdown', function(){
      console.log("mousedown");

    });

```
Simple way to make it:

```
map.events.listeners.mousedown.unshift({ 
    func: function(){
        // code
    }
});

```