As of now (October 2017) Google has implemented a specific property to handle the zooming/scrolling, called gestureHandling
. Its purpose is to handle mobile devices operation, but it modifies the behaviour for desktop browsers as well. Here it is from official documentation:
function initMap() { var locationRio = {lat: -22.915, lng: -43.197}; var map = new google.maps.Map(document.getElementById('map'), { zoom: 13, center: locationRio, gestureHandling: 'none' });
The available values for gestureHandling are:
'greedy'
: The map always pans (up or down, left or right) when the user swipes (drags on) the screen. In other words, both a one-finger swipe and a two-finger swipe cause the map to pan.'cooperative'
: The user must swipe with one finger to scroll the page and two fingers to pan the map. If the user swipes the map with one finger, an overlay appears on the map, with a prompt telling the user to use two fingers to move the map. On desktop applications, users can zoom or pan the map by scrolling while pressing a modifier key (the ctrl or ? key).'none'
: This option disables panning and pinching on the map for mobile devices, and dragging of the map on desktop devices.'auto'
(default): Depending on whether the page is scrollable, the Google Maps JavaScript API sets the gestureHandling property to either'cooperative'
or'greedy'
In short, you can easily force the setting to "always zoomable" ('greedy'
), "never zoomable" ('none'
), or "user must press CRTL/? to enable zoom" ('cooperative'
).