Disable the Ctrl + Scroll to Zoom google maps
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: 4,
gestureHandling: 'greedy'
});
Update! Since Google Maps 3.35.6
you need to encase the property into an options wrapper:
const map = new google.maps.Map(mapElement, {
center: { 0, 0 },
zoom: 4,
options: {
gestureHandling: 'greedy'
}
});
Thank you ealfonso
for the new info
If you're OK with disabling scroll-to-zoom entirely, you can use scrollwheel: false
. The user will still be able to zoom the map by clicking the zoom buttons if you provide them with the zoom control (zoomControl: true
).
Documentation: https://developers.google.com/maps/documentation/javascript/reference (search the page for "scrollwheel")
const map = new google.maps.Map(mapElement, {
center: { 0, 0 },
zoom: 4,
scrollwheel: false,
zoomControl: true
});