I am trying to disable the scroll zoom functionality in OpenLayers. I have tried different things but nothing works. First I tried this:

map.addControl(new OpenLayers.Control.Navigation({'disableZoomWheel':true}));

But nothing happened. Then I found this here and I tried it but didn't work either. Actually in this case the page doesn't even load anymore.

Any ideas what to do?


Did you deactivate the navigation control that gets added to the map by default? If not so than you still have a navigation control with activated scroll wheel zoom.

| improve this answer | |

Assuming you are referring to OL3 and not OL2. You need to use ol.interaction.MouseWheelZoom. I'm not exactly sure, but you might just be able to do ol.interaction.MouseWheelZoom.active = false; or you may need to bind to a specific event with something along the lines of ol.interaction.MouseWheelZoom.on('zoom', function () {});

| improve this answer | |
  • 1
    Given the use of OpenLayers.Control, I'd say the question is about OL2. – Jose Gómez Dec 4 '16 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.