[GIS] How to disable all mouse events in OpenLayers map div

eventsinternet exploreropenlayers-2

version: OpenLayers-2.13.1

brower : IE8 (I Hit it!!! But I need to work on it)

I create a div with id 'map' to display OpenLayers map. Sometimes, I need disable map div catch any mouse events, let me enable "drag" items into map (not really drag and drop event). But I don't know how to disable the map receives mouse events, so, I dynamically create a new div into the HTML body to cover above the map, make the new div receive all mouse events and without pass these events to the map, by this way, Google Chrome works well, but in IE8 is not!!!! So….. sad!!

In IE8, the created new div only receive mousemove event at itself's border, when mouse inner blank area of the new div, the mousemove events be received by the map div, upper level's new div receive nothing. In Chrome, when mouse move onto the new div, no matter on the border or inner blank area, all mouse event pass to upper level's new div first, the map div would not receive!

Could anybody told me how to make OpenLayers map div avoid receive mouse events and how to restore receive mouse events ability? If use new div cover upper the map, how to let upper div receive all mouse events in IE?

Best Answer

If you are creating your map without any initial controls definition the Navigation control is added to answer mouse events.

Create a map defining the controls you want to add (or an empty list). Check this example to see how to pass the controls list on map creation.

You can also activate/deactivate the control at your will, check the docs.

See an example: adding a "controls:[]" to your map options creates it without any control so no navigation is possible.