How do I change the Google Maps draggable property for the map (not the marker)?

draggable, google-maps-api-3

Solution

Try:

map.setOptions({draggable: true});

Problem

In the Google Maps v3 reference, I see there is a method `setDraggable(boolean)` which can be applied to a map marker. However, I want to set `setDraggable` to `true` on the map, not on a map marker. I have set the property `draggable` to `false` in the mapOptions, but I don't know how to set this to `true` later... `map.setDraggable(true)` does not work: ``` // object literal for map options var myOptions = { center: new google.maps.LatLng(37.09024, -95.712891), zoom: 4, // smaller number --> zoom out mapTypeId: google.maps.MapTypeId.TERRAIN, // removing all map controls disableDefaultUI: true, // prevents map from being dragged draggable: false, // disabling all keyboard shortcuts keyboardShortcuts: false, disableDoubleClickZoom: true, // do not clear the map div noClear: true }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); map.setDraggable(true); // does NOT work! ```

Original source