Ravi Shah
Ravi Shah

Reputation: 873

Enable the Ctrl + Scroll to Zoom google maps

Enable Ctrl+Scroll option

How to enable message ctrl + Scroll zoom message in google map? Map option define below.

 var mapOptions = {
    mapTypeId: 'roadmap', center: new google.maps.LatLng(countryLat, countryLon), zoom: countryZoom, gestureHandling: 'cooperative'
};

I need output like this when mouse scroll : Need map output

Upvotes: 2

Views: 6475

Answers (3)

samveg sharma
samveg sharma

Reputation: 73

Use the following option to control this behavior:

gestureHandling: 'cooperative'

As per the instructions mentioned here: Controlling Zoom and Pan (developers.google.com)

Upvotes: 7

Tobias
Tobias

Reputation: 65

This function seems to only work in the experimental version of the API. So just change the version in the URL to 3.exp or to 3.30 (which is the current experminatal version) so your URL in the script would look something like this:

"https://maps.googleapis.com/maps/api/js?v=3.30&sensor=false&key=" + your_api_key

You can also remove the version tag so it will always use the latest version of the API.

Hope this fix your issue.

Upvotes: 0

Chirag Viradiya
Chirag Viradiya

Reputation: 487

If you want to enable the ctrl + scroll to zoom on map have to pass the gestureHandling: 'greedy' this option in the javascript of google map object. you just passed the

Ref.: Click here to look at reference

and as per i seen there are any issue worth your css because here is the link which is exactly as you want please refer this link

Upvotes: 0

Related Questions