Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps -> Setting a marker as draggable, I want to stop it from being draggable later on via client side logic?

So, I know how to plot a marker on the map.

I have an event that occurs once that event occurs on the client side I need to stop the marker from being draggable from that point on.

I thought it might be as simple as this. :

marker.setDraggable = false;

From what I can see this is not working, I see that it has the setIcon and several other methods, but not seeing how I can stop draggable.

Any advice/suggestions is greatly appreciated. I have been looking at this for quite some time.

like image 204
Bill Blankenship Avatar asked Jul 10 '12 22:07

Bill Blankenship


People also ask

How do I move a marker smoothly on Google Maps?

The initialize() function creates a Google Map with a marker. The transition() and moveMarker() are used to move marker smoothly on click on the Google map.

How do I get the formatted address from a dragged marker on Google Maps?

You need to use the reverse geocoding service (as demonstrated in the example you link to) to retrieve the formatted address.


1 Answers

Marker has a setDraggable method, so you want marker.setDraggable(false);

https://developers.google.com/maps/documentation/javascript/reference#Marker

like image 82
puckhead Avatar answered Sep 27 '22 19:09

puckhead