Change Google Maps v3 mapOptions object after load

前端 未结 3 696
小蘑菇
小蘑菇 2020-12-29 22:55

How can i modify a V3 map\'s mapOptions (after the initial map has been loaded)?

Specifically, I would like to be able to flip the

draggable: false
         


        
3条回答
  •  鱼传尺愫
    2020-12-29 23:01

    If you have already created the map previously, you can set several options ( https://developers.google.com/maps/documentation/javascript/reference#MapOptions ) at once like this:

    var myOptions = {
                        zoom:11,
                        center: new google.maps.LatLng(-34.397, 150.644),
                        mapTypeId: google.maps.MapTypeId.ROADMAP,
                        panControl: false
                    };
    
    map.set(myOptions);
    

提交回复
热议问题