Allow zooming only with scroll in google maps

2019-01-24 03:10发布

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

1条回答
淡お忘
2楼-- · 2019-01-24 03:26

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'
  });
}
查看更多
登录 后发表回答