Search code examples
google-mapsgoogle-maps-api-3scrollkeyzooming

Allow zooming only with scroll in google maps


Since a few days our users can only zoom when they hit the "ctrl" key while scrolling which doesn't make sense in our applications.

Is there a way to allow zooming only with scrolling (as it was before) in Google Maps?

I've seen that this "ctrl + scroll" force now also is in the google maps api reference (screenshot).

Screenshot from the Google Maps Javascript API reference which shows the new message


Solution

  • Add gestureHandling: 'greedy' to your map options during instantiation.

    E.g:

    var map = new google.maps.Map(document.getElementById('map'), {
        center: {0, 0},
        zoom: 8,
        gestureHandling: 'greedy'
      });
    }