How to disable the dragging in google maps in your website in order to freeze it like an image? I've just used basic Iframe
code that gives me google maps.
A user can scroll (pan) around the map by dragging the map with their finger. You can disable scrolling by calling UiSettings. setScrollGesturesEnabled(boolean).
To get an overlay for a landmass, type the name of a state or country in the box in the top left corner of the site and choose the country from the matching list of names. The landmass will be dropped onto the map. You can move the landmass by clicking on it, holding down the mouse button, and dragging.
You can set draggable: false
in the setOptions()
method on your map object:
map.setOptions({draggable: false});
More here.(Ctrl + f and search 'draggable')
The draggable
property has been deprecated.
To disable dragging on the map, you can now use the gestureHandling
property, and set it to "none"
.
You can also disable the use of arrow keys, by setting keyboardShortcuts
to false
ex: map.setOptions({gestureHandling: "none", keyboardShortcuts: false});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With