Dawood Awan Dawood Awan - 1 year ago 151
Javascript Question

Disable the Ctrl + Scroll to Zoom google maps

Does anybody know how to disable the

Ctrl + Scroll
?

First when the mouse wheel was moved the Map would Zoom in/out. But know it asks to press Ctrl + Mouse Wheel Scroll to Zoom in/out.

How do we disable this feature? I can't seem to find anything in the documentation:

https://developers.google.com/maps/documentation/javascript/controls#ControlOptions

enter image description here

Answer Source

You need to pass gestureHandling: 'greedy' to your map options.

Documentation: https://developers.google.com/maps/documentation/javascript/interaction#gestureHandling

For example:

const map = new google.maps.Map(mapElement, {
  center: {0, 0},
  zoom: 8,
  gestureHandling: 'greedy'
});
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download